BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi

I need help with the following:

I have a value in a cell in Excel which I wan to use in my data step. The value could a position of a file or database.

Data new.table;
set ________here goes the value of the cell in excel____________ ;
Run;

I think I need to do a data step before this step that retrieves all my cells in excel and then to Data_null to define my new variabe. But so far I cant get it to work,.

I would preciate any help

Thanks and have a good weekend
2 REPLIES 2
Cynthia_sas
SAS Super FREQ
Hi:
There would be a difference between the name of a SAS dataset (such as you would use in a SET statement) and the name of a database location or table (such as you might use in a LIBNAME statement) or the name of an operating system file (such as you might use in a FILENAME or INFILE statement). However, in any of these cases, after you read your Excel file, then you could create a SAS macro variable from your variable value using either CALL SYMPUT or a PROC SQL SELECT with INTO. Then, the macro variable reference could be used in a LIBNAME statement or a SET statement or in any other code where you needed to reference a value that had to come from a variable value in a different data set.

If you don't know about SAS macro variables and how they work, this paper has a good introduction to SAS Macro concepts.
http://www2.sas.com/proceedings/sugi28/056-28.pdf
(Step 4 shows the CALL SYMPUT method of creating a macro variable; Step 8 shows the PROC SQL method.)

cynthia
deleted_user
Not applicable
Hi

ThankS! i will try this.

I really preciate your help!

I hope i can do the code..:-)

Have a nice day

sas-innovate-2024.png

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.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 592 views
  • 0 likes
  • 2 in conversation