Hi, I have a data set in CSV that looks like the following. T1 - T29 are actually the column names for the data columns that follows at the bottom.
How do I use SAS EG to assign the column names (T1, T2, T3, etc) to the columns that i extracted using the import wizard as seen below, instead of the default column names F1, F2, etc?
Appreciate any input! thanks very much
Regards
Nat
If you can make a MAP file to display how to rename them, That would be easy. data map; input old $ new $; cards; F1 T1 F2 T2 ; run; data _null_; set map end=last; if _n_=1 then call execute('proc datasets lib=work nolist nodetails;modify have;rename '); call execute(catx('=',old,new)); if last then call execute(';quit;'); run;
If you know the exactly number of variables, that would be easy. data want; set have(rename=(F1-F29=T1-T29)); run;
Thanks but the column names are actually the ones hidden in black (for confidentiality purposes), so its not as easy as "T1" and "T2" etc. It looks something like P1TU45S and Q_24FTG, etc.
I tried to import that column separately and transpose so I would have a table with a single row where the column name is the same as the data in the first row. I thought it would work if I appended these two tables but it didnt.. furthermore the formats don't match (i.e. column name table has all characters and data table is numeric, hence no match).
Any suggestions?
Regards,
Nat
If you can make a MAP file to display how to rename them, That would be easy. data map; input old $ new $; cards; F1 T1 F2 T2 ; run; data _null_; set map end=last; if _n_=1 then call execute('proc datasets lib=work nolist nodetails;modify have;rename '); call execute(catx('=',old,new)); if last then call execute(';quit;'); run;
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.