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
Diamond | Level 26
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

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore 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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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