Hi all SAS Users,
Today I want to do find how many distinct value of currency (curcdd)( a character variable)of a country. Because the dataset is large so I split them into many small files in one folder as in the picture below:
For example, my code successfully run for one file to retrieve the distinct currency for Romania (LOC='ROU') in file keepvar_1999_2001 is:
libname tests 'E:\Harv 27th_Feb_2021\data_cut';
proc sql;
create table _1999_2001 as
select distinct curcdd
from tests.keepvar_1999_2001
where LOC='ROU';
quit;
I am wondering how to code to get the distinct value of curcdd for all files in this folder for Romania (LOC='ROU').
I thought it would relate to the code below but I do not know how to merge them together:
proc contents data=tests._ALL_ out=contents;
run;
proc sql noprint;
select distinct catx('.',libname,memname)
into :dslist separated by ' '
from contents
;
quit;
Warm regards.
One further question is how to do the same things (distinct value of currency ) for LOC in array ('AUS','AUT','BEL','CAN','CYP','DNK','FIN','FRA','DEU', 'GRC','HKG','IRL','ISR','ITA','JPN','LUX','NLD','NZL','NOR','PRT', 'SGP','KOR','ESP','SWE','CHE','TWN','GBR','USA','ARG','BRA','CHL', 'CHN','COL','HRV','CZE','EGY','EST','HUN','IND','IDN','KEN','LTU', 'MYS','MEX','MAR','PAK','PER','PHL','POL','ROU','SVN','ZAF','LKA', 'THA','TUR','VEN','LVA','SVK','BGR') for all files in this folder.
... View more