Now that this thread is coming to a close, how do I (or do I?) give credit to those that helped? I notice in other threads there are "Useful Answers" and "Correct Answers" labeled and would like to give credit those that have helped where due.
to label as correct or helpful answers, you need to log in first. then at the lower portion of the box that surrounds each response there are two icons: one that indicates "correct answer" and one that indicates "helpful answer".
Not seeing any icons - I see Branch, Like, and Reply and that is all. And yes, I am logged in.
Hi,
please check the attached screen shot. do you see something like that?
Nope, not there. This is all I see. And yes, I am logged on.
%macro double_transpose_file(file);
data foo;
infile "&file" dsd dlm=',' lrecl=32767 missover;
input @;
_infile_=prxchange('s/#n\/a//o',-1,_infile_);
input var :$32. (val1-val657) (:$100.); *<--<</Assumption is every file has same number of initial columns;
run;
proc transpose data=foo out=bar(drop=_name_);
id var;
var val1-val657; *<--<</Assumption is every file has same number of initial columns;
run;
proc sql noprint;
select name into :name1-:name2
from dictionary.columns
where libname='WORK' and memname='BAR'
having varnum=4 or varnum=max(varnum);
quit;
proc transpose
data = bar
out = foobar( rename = ( col1 =amount
_name_ =date )
where = ( not missing(amount) )
);
by name code currency notsorted;
var "&name1"n -- "&name2"n;
run;
proc append
base=want
data=foobar;
run;
%mend;
%macro run_on_dir;
filename dir&sysindex pipe "dir /s /b C:\path\to\files\*.csv"; *<--<<Enter path to files here;
data _null_;
infile dir&sysindex end=done;
input;
call symputx(cats('file',_n_),_infile_);
if done then call symputx('nfiles',_n_);
run;
%do i=1 %to &nfiles;
%double_transpose_file(&&file&i);
%end;
%mend;
%run_on_dir;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.