Explanation : Definition of the main macro. It initializes the table with the first request, then loops through years and pages to accumulate data via HTTP GET requests and SQL unions.
Copied!
%macro json(data_final, String05, date_s, date_e);
%let url=&string05?FSCL_YY=&date_s.&key=&string01&type=json&pindex=1&psize=1000;
filename out temp;proc http url="&url" method="get" out=out;run;
libname raw json fileref=out;
data &lib .&data_final;set raw.Revenuessettled_row;run;
%do date_want=&date_s %to &date_e;
%do string02=1 %to 4;
%let url=&string05?FSCL_YY=&date_want.&key=&string01&type=json&pindex=&string02&psize=1000;
filename out temp;proc http url="&url" method="get" out=out;run;
libname raw json fileref=out;
proc sql;
create table &lib .&data_final as
select distinct * from
(select a.* from &lib .&data_final as a union select b.* from raw.Revenuessettled_row as b)
quit;
run;
%end;
%end;
%mend;
Explanation : Cleaning the final table (removing missing years) and applying metadata (column labels) in Korean.
Copied!
data &lib .longdata_002;
set &lib .longdata_002;
if FSCL_YY="" then delete;
label FSCL_YY=회계연도;
/* ... (autres labels omis pour brièveté) ... */
label NRC_AMT =미수납액(원);
run;
1
DATA &lib .longdata_002;
2
SET &lib .longdata_002;
3
IF FSCL_YY=""THEN delete;
4
label FSCL_YY=회계연도;
5
/* ... (autres labels omis pour brièveté) ... */
6
label NRC_AMT =미수납액(원);
7
RUN;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.