Hi ,
I am creating a csv file from sas dataset using ds2csv utility.
I want the column names of this csv file to be lower case. I have given a sample code as well
Can someone please help me with this
data temp;
input NAME $ AGE;
datalines;
ram 21
ravi 34
;
run;
%ds2csv(data=temp,labels=N,runmode=b,csvfile=/out/temp.csv)
You could make a copy of the dataset (or a view that is a copy of the dataset) and either change the names to be lowercase.
data for_csv;
retain name age;
set temp;
run;
or attach labels using the lowercase version of the names and use the labels as the column headers.
But since CSV files are trivial to write yourself you could do that. Which means you can add aline to convert the names to lowercase before writing them.
proc transpose data=temp(obs=0) out=names;
var _all_;
run;
data _null_;
file '/out/temp.csv' dsd ;
set names;
_name_=lowcase(_name_;
put _name_ @;
run;
data _null_;
set temp;
file '/out/temp.csv' dsd mod ;
put (_all_) (+0);
run;
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 how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.