Help using Base SAS procedures

Need help. Dynamic data step

Posts: 0

Need help. Dynamic data step


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____________ ;

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
Posts: 8,743

Re: Need help. Dynamic data step

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.
(Step 4 shows the CALL SYMPUT method of creating a macro variable; Step 8 shows the PROC SQL method.)

Posts: 0

Re: Need help. Dynamic data step


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
  • 2 in conversation