BookmarkSubscribeRSS Feed
SmcGarrett
Obsidian | Level 7

Hello,

 

I have a data set in Excel which lists attributes of about 5000 variables. When I read in data into SAS, I build a dataset and if I need to add these attributes I have to these attributes I do a merge ...similar to a vlookup... to retrieve the additional information from the excel sheet and put it into the SAS data set I'm creating. Is there a way I could read the excel sheet into SAS, and save it in such a way that whenever I need to do a merge or request information from that sheet, it's not tied to the excel sheet? 

 

Garrett

 

 

2 REPLIES 2
Reeza
Super User

Save the dataset in a permanent library. 

 

Libname mydata 'C:\Project1';

Data mydata.attributes;
Set attributes;
Run;

Then the next time you need to use it, create the libname reference and use the saved dataset as (mydata.atteibutes). 

ballardw
Super User

I'm not quite sure if you have ever read this data into SAS. Have you? If so then creating and assigning a permanent library as @Reeza suggests is the way to go.

If you have never  actually read the data into SAS then I would suggest 1) save your spreadsheet as a CSV file. Use the import wizard to import the data. If you have a permanent library with your other data then import it into that library.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 805 views
  • 0 likes
  • 3 in conversation