Help using Base SAS procedures

SAS basics for new learner

Reply
New Contributor
Posts: 2

SAS basics for new learner

Hi everyone!

 

I have a few questions in regards to a few things. mainly trying to figure out a few things for a class I am currently taking. So, going to post some of the questions:

 

What are the functions of the '*' and the ' /* */' combination? 

-Basically, they are mainly used for creating comments correct? 

 

With exporting in SAS, what happens if the file type does not match the dbms? And what is a way to avoid this in general? Or an ingenious way to avoid this?

 

Say I want to import an EXCEL sheet with the following code:

 

PROC IMPORT OUT= AGR.myfirstdata
DATAFILE= "&path.&XL_in"
DBMS=xls REPLACE;
RANGE="Data";*use either range or sheet but not both;
*Sheet=CIR_02;
GETNAMES=YES;
RUN;
proc print data=AGR.myfirstdata;run;

 

What happens if I put all the lines into one sheet? Nothing happens?  Do I get a premature termination and an error? SAS terminates and a force restart? 

 

Super User
Posts: 5,884

Re: SAS basics for new learner

Hi,
If you are taking a class I think you should direct your immediate question to your tutor.
That said:
/* */ is programming languages standard concept of holding comments.

For the Excel export, why don't you try and see for yourself?
Data never sleeps
New Contributor
Posts: 2

Re: SAS basics for new learner

I have tried it for myself. I just want to make sure I am on the right path. Also, discussed with my tutor, but again.. want to double check on everything before I steam ahead. 

Super User
Posts: 23,774

Re: SAS basics for new learner


@Kris18 wrote:

With exporting in SAS, what happens if the file type does not match the dbms? And what is a way to avoid this in general? Or an ingenious way to avoid this?

Say I want to import an EXCEL sheet with the following code:

PROC IMPORT OUT= AGR.myfirstdata
DATAFILE= "&path.&XL_in"
DBMS=xls REPLACE;
RANGE="Data";*use either range or sheet but not both;
*Sheet=CIR_02;
GETNAMES=YES;
RUN;
proc print data=AGR.myfirstdata;run;

 

SAS isn't going to care about the file extension, it writes the file with the DBMS specified. 

I'm assuming by 'file type' you mean extension? You can change that to whatever you want, it may or may not change the underlying data but that has nothing to do with SAS and more to do with how the file system and other applications work. 

Ask a Question
Discussion stats
  • 3 replies
  • 147 views
  • 0 likes
  • 3 in conversation