BookmarkSubscribeRSS Feed
rmg1995
Calcite | Level 5

I'm trying to get the fist variable to show. According to the code book it should all be numbers but indicating it's a character seems to be the only way to get this to show (if I leave out the $ then it just shows a . for a missing value). Can anyone tell me what I'm doing wrong? I'm using SAS On Demand for Academics.

 

I attached my code and the output. 

 

Just a few notes about my code: I used Var1 as my variable name but I plan to change that to CaseID and I do plan on doing more variables I'm just trying to get it together little by little. 

 

Thanks in advance. 

 

SAS Code 2.jpegSAS Output 1.jpeg

3 REPLIES 3
ballardw
Super User

If a file is a SAS7BDAT then it is already a SAS data set an should not be "input".

You would use it by using the Libname.dataset syntax.

Such as

Proc Print data=work.dhs;
run;

Or maybe sasuser.dhs, I don't use SAS On Demand so the pictures don't mean much to me.

 

Infile and Input are used to read TEXT files into SAS data sets. These would typically have extensions like TXT, CSV, TAB, sometimes DAT but the extension you have is a SAS data set.

rmg1995
Calcite | Level 5

When I do it without the 'infile' statement it won't work properly and without the 'input' statement it is throwing an error saying it doesn't have any columns. It also tells me that work.dhs doesn't exist. 

ballardw
Super User

You also have  CASE problem with naming your set. SAS On Demand runs in a UNIX environment and you really want to use lower case for library and dataset names.

 

Try using capstone.dhs in your print. (define the library with lower case capstone).

If there is a problem copy the text from the log with the CODE and any messages. On the forum open a text box using the </> icon above the message window and paste the text.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 3 replies
  • 575 views
  • 0 likes
  • 2 in conversation