Parametrization in using proc import

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 8
Accepted Solution

Parametrization in using proc import

Hi everyone,

I'm trying to write a Macro to import an excel file into SAS 9.3. My excel file it could be excel 2003 , 2007 ....or whatever.

I start by checking the excel file extension ( xls, xlsx, xlsb, xlsm) and I store it in a Macro variable ExtenFile .  My problem that,  I don't know if I can use a macro variable to store dbms connection( ConnDbms). So, if extenFile=xls (excel 2003)  then ConnDbms=Excel , else ConnDbms=Excelcs (excel 2007).

So when I call the Proc import,  I can write :  dbms = &ConnDbms

I'm new in using SAS ( 1 month) so I'm sorry if I write anything wrong !


Accepted Solutions
Solution
‎05-06-2014 01:58 AM
Super Contributor
Posts: 644

Re: Parametrization in using proc import

Maya

I have searched all SAS documentation for the term 'SGBD' without success.  I think you may be referring to the DBMS= option in Proc Import.  You can use DBMS= EXCEL for older xls files or DBMS= EXCELCS for more recent versions. 

You could have the following code

Proc Import     file = <filename or file reference>

          out = <SAS tablename>

          DBMS = &ConnSgbd

          etc ..

Run ;

See a full explanation of the option in SAS/ACCESS(R) 9.4 Interface to PC Files: Reference, Second Edition

Richard

View solution in original post


All Replies
Solution
‎05-06-2014 01:58 AM
Super Contributor
Posts: 644

Re: Parametrization in using proc import

Maya

I have searched all SAS documentation for the term 'SGBD' without success.  I think you may be referring to the DBMS= option in Proc Import.  You can use DBMS= EXCEL for older xls files or DBMS= EXCELCS for more recent versions. 

You could have the following code

Proc Import     file = <filename or file reference>

          out = <SAS tablename>

          DBMS = &ConnSgbd

          etc ..

Run ;

See a full explanation of the option in SAS/ACCESS(R) 9.4 Interface to PC Files: Reference, Second Edition

Richard

Occasional Contributor
Posts: 8

Re: Parametrization in using proc import

Yes , excatly , I mean Dbms , thanks so much for your  help :-)

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 184 views
  • 1 like
  • 2 in conversation