01-09-2018 12:27 PM
Hello SAS guys,
I import multiply datasets into SAS. I want my datasets group by monthly and cumulative. If I want my reports generated both monthly and cumulative, how do I code?
Here is the sample codes:
filename indata pipe "dir &datadir. /b";
length fname$ 256.;
infile indata truncover; /* infile statement for file names */
input fname$ 256.; /* read the file names from the directory */
Proc sql noprint;
create table filename as
select fname from file_list where fname contains ".txt";
select count(DISTINCT fname) into :num_files from filename;
select distinct fname into :filein1 - :filein%left(&num_files) from filename;
create table name as
select compress( scan(fname,1,"."),"&","i" )as fname from filename;
select compress(fname," 12345abced","kis")into :name1 - :name%left(&num_files)
%do j=1 %to &num_files;
proc import datafile="&datadir.\&&filein&j." out=&&name&j. dbms=csv replace;
/*Now I import three monthly data into SAS. */
%if &report="Cumulative" %then %do;
set data10 - data12;
But it seems that SAS ignore the condition: &report="Cumulative".
Any help is appreciated.
Need further help from the community? Please ask a new question.