I have an existing data set prepared from an external csv file(file1) (csv file has no headings), with column names as var1, var2, var3, so on.
For the column names, I have a different excel file (file2), can anybody help me with how to get the column names from file2 into existing dataset (created from file1).
PS: New to SAS env. Any help will be highly appreciated.
Thanks for the prompt response but however I have 29 data files that are not having header.
the 30th file is having headers for all the above 29 data files and header details are listed in the below format:
FileName - Table1
Field11 Description11
Field12 Description12
FileName - Table2
Field21 Description21
Field22 Description22
I hope you understand this.
The only solution that I can think of is renaming the variables while preparing the dataset. Otherthan this I have no other clue.
Please see if any sample macro you can provide which caters this scenario.
@james_alive wrote:
Thanks for the prompt response but however I have 29 data files that are not having header.
the 30th file is having headers for all the above 29 data files and header details are listed in the below format:
FileName - Table1
Field11 Description11
Field12 Description12
FileName - Table2
Field21 Description21
Field22 Description22
I hope you understand this.
The only solution that I can think of is renaming the variables while preparing the dataset. Otherthan this I have no other clue.
Please see if any sample macro you can provide which caters this scenario.
Does Description include useful information like data type and informat?
Description here means, the descriptive text for file. for eg,
filename1 - File is used to calculate the annual premium
A very similar topic is in this thread
it may contain some helpful hints.
Also, if you separately proc import 30 datasets that should be the same you face a very real possibility of having some variables as characte in some sets and numeric in others, or the lengths of character variables being incompatible. So you may have more work ahead than just renaming columns, especially if your next step involved combining any of these sets.
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 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: