BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
tony3141
Calcite | Level 5

I'm using SAS Studio University Edition. The main reason I have it is to go through the SAS certification prep guide for Base programming. I have my shared folders for the Virtual machine at D:\Data\SAS\SASUniversityEdition\myfolder. I was able to get the files used for the prep guide and I see them in the folders tab under My Folders/sasuser.v94. I'm trying to do the first example which is to load the admit.dat data and then print it out. I am able to read it in, but the working data says it has 0 observations and 9 variables. Here is the code I use to bring in the data.

     filename admit '/folders/myfolders/sasuser.v94/admit.dat';

     data admit2;

        infile admit;

        input ID 1-4 Name $ 6-25 RestHR 27-29 MaxHR 31-33

              RecHR 35-37 TimeMin 39-40 TimeSec 42-43

              Tolerance $ 45;

        if tolerance='D';

        TotalTime=(timemin*60)+timesec;

     run;

     proc print data=admit2;

     run;

And here is the Log showing the issue:

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;

42 ;

43 filename admit '/folders/myfolders/sasuser.v94/admit.dat';

44 data admit2;

45 infile admit;

46 input ID 1-4 Name $ 6-25 RestHR 27-29 MaxHR 31-33

47 RecHR 35-37 TimeMin 39-40 TimeSec 42-43

48 Tolerance $ 45;

49 if tolerance='D';

50 TotalTime=(timemin*60)+timesec;

51 run;

NOTE: The infile ADMIT is:

  Filename=/folders/myfolders/sasuser.v94/admit.dat,

  Owner Name=sasdemo,Group Name=sas,

  Access Permission=-rw-rw-r--,

  Last Modified=05Oct2014:22:13:58,

  File Size (bytes)=1701

NOTE: 21 records were read from the infile ADMIT.

  The minimum record length was 80.

  The maximum record length was 80.

NOTE: The data set WORK.ADMIT2 has 0 observations and 9 variables.

NOTE: DATA statement used (Total process time):

  real time 0.02 seconds

  cpu time 0.03 seconds

  

52 proc print data=admit2;

53 run;

NOTE: No observations in data set WORK.ADMIT2.

NOTE: PROCEDURE PRINT used (Total process time):

  real time 0.04 seconds

  cpu time 0.01 seconds

  

54 

55 

56 

57 ;

58 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;

68 ;

Any help would be appreciated...

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

I would start by looking in the text file at the value of Tolerance. Comment out the line "If Tolerance = 'D'; and examine the values you actually read for Tolerance. Since you assigned a length of 45 I'm willing to be that at least some if not all of the values of tolerance are 1) longer than 'D' and 2) possibly not uppercase, i.e. 'd'.

View solution in original post

2 REPLIES 2
ballardw
Super User

I would start by looking in the text file at the value of Tolerance. Comment out the line "If Tolerance = 'D'; and examine the values you actually read for Tolerance. Since you assigned a length of 45 I'm willing to be that at least some if not all of the values of tolerance are 1) longer than 'D' and 2) possibly not uppercase, i.e. 'd'.

tony3141
Calcite | Level 5

Yep, when I removed that line it worked. Thank you.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 613 views
  • 0 likes
  • 2 in conversation