I have an infile that stores in my work.temp and I want to have the ability to put " " around the column headers and the data itself. The data is text and numeric. I need the data formatted like this and then export to a .csv comma dil to FTP to someone that needs it in that format for their intake system. I have looked and looked all over and cannot find any information on how to perform this. Is it a data have data want?
Data Have
MID memID add add2 city state zip age
111 11111 123 chase street newark nj 01010 52
Data Need
"MID" "memid" "add" "add2" "city" "state" "zip" "age"
"111" "11111" "123 chase street" " " "newark" "nj" "01010" "52"
Use the technique posted by @data_null_; here:
Just adjust to use the ~ modifier instead of the : modifier to force the quotes.
Also did you want TAB delimited like your example or COMMA delimited (which is what CSV means).
data _null_;
set SASHELP.class;
file log dlm=',' dsd;
if _n_ eq 1 then link names;
put (_all_)(~);
return;
names:
length _name_ $32;
do while(1);
call vnext(_name_);
if upcase(_name_) eq '_NAME_' then leave;
put _name_ ~ @;
end;
put;
return;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.