Data is read in from file, but data in work library has 0 observations

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

Data is read in from file, but data in work library has 0 observations

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...


Accepted Solutions
Solution
‎10-07-2014 03:56 PM
Grand Advisor
Posts: 10,233

Re: Data is read in from file, but data in work library has 0 observations

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


All Replies
Solution
‎10-07-2014 03:56 PM
Grand Advisor
Posts: 10,233

Re: Data is read in from file, but data in work library has 0 observations

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'.

New Contributor
Posts: 2

Re: Data is read in from file, but data in work library has 0 observations

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

☑ This topic is SOLVED.

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

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