Help using Base SAS procedures

Need help. Dynamic data step

Reply
N/A
Posts: 0

Need help. Dynamic data step

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
SAS Super FREQ
Posts: 8,868

Re: Need help. Dynamic data step

Posted in reply to deleted_user
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
N/A
Posts: 0

Re: Need help. Dynamic data step

Posted in reply to deleted_user
Hi

ThankS! i will try this.

I really preciate your help!

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

Have a nice day
Ask a Question
Discussion stats
  • 2 replies
  • 98 views
  • 0 likes
  • 2 in conversation