BookmarkSubscribeRSS Feed
ayosas
Fluorite | Level 6

Trying to read data into SAS Studio I keep getting an error message that the table cannot be opened because it does not contain columns.

 

I actually copied this code from the previous assignment where it worked so I don't know what I am doing wrong. Here is the code:

 

libname hw4 "/home/u49728966/SAS Data/";
run;
data ldldat;
set hw4.ldldat;
run;

 I tried an infile statement (albeit probably incorrectly because we have not covered that in class) and that did not work either. Can anyone help?

 

I am a beginner, please use the simplest language possible.

10 REPLIES 10
Kurt_Bremser
Super User

Please post the complete log of this code into a code box; note that the RUN after the LIBNAME is not necessary, LIBNAME statements are executed immediately.

ayosas
Fluorite | Level 6
 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 72         
 73         libname hw4 "/home/u49728966/SAS Data/";
 NOTE: Libref HW4 was successfully assigned as follows: 
       Engine:        V9 
       Physical Name: /home/u49728966/SAS Data
 74         data ldldat;
 75         run;
 
 NOTE: The data set WORK.LDLDAT has 1 observations and 0 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       user cpu time       0.01 seconds
       system cpu time     0.00 seconds
       memory              556.18k
       OS Memory           31908.00k
       Timestamp           10/06/2020 06:04:25 AM
       Step Count                        164  Switch Count  2
       Page Faults                       0
       Page Reclaims                     87
       Page Swaps                        0
       Voluntary Context Switches        9
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           160
       
 
 76         
 77         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 89         

Noted about the run after libname, I realized that as well thank you. 

Kurt_Bremser
Super User

This is different from the code you initially posted:

 74         data ldldat;
 75         run;

Since that DATA step does not contain a SET statement, it does not read anything; it will also not create any columns; but since one data step iteration (including the implicit output) is made, a dataset with no columns but one observation is created.

Add the proper SET statement.

ayosas
Fluorite | Level 6

I tried it with a set statement as well. What do you mean different? There is a data set called ldldat.sas7bdat in the file SAS Data. 

 

libname hw4 "/home/u49728966/SAS Data/";
data ldldat;
set hw4.ldldat;
run;  

That didn't work. The log says 

 

1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 72         
 73         ;
 74         
 75         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 87         

 

Kurt_Bremser
Super User

When you hit the submit button, you had a single semicolon in your code selected, so SAS Studio sent only that to the workspace server.

SAS Studio will always send the selection to the SAS session, if a part of the code is selected.

Kurt_Bremser
Super User

@ayosas wrote:

 What do you mean different?

 


Your code as posted in the initial question contains a SET statement, but the log you posted does not; so the log was from a different version of the code.

ayosas
Fluorite | Level 6

I see. Well now my code looks like this

libname hw4 "/home/u49728966/SAS Data/";
data ldldat;
set hw4.ldldat;
run;

I selected all of it, pressed run and received the same error. The log says

 

 

1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 72         
 73         libname hw4 "/home/u49728966/SAS Data/";
 NOTE: Libref HW4 was successfully assigned as follows: 
       Engine:        V9 
       Physical Name: /home/u49728966/SAS Data
 74         data ldldat;
 75         set hw4.ldldat;
 76         run;
 
 NOTE: There were 1 observations read from the data set HW4.LDLDAT.
 NOTE: The data set WORK.LDLDAT has 1 observations and 0 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       user cpu time       0.00 seconds
       system cpu time     0.00 seconds
       memory              734.78k
       OS Memory           31908.00k
       Timestamp           10/06/2020 07:08:15 AM
       Step Count                        187  Switch Count  2
       Page Faults                       0
       Page Reclaims                     76
       Page Swaps                        0
       Voluntary Context Switches        13
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           160
       
 
 77         
 78         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 90         

 

 

ayosas
Fluorite | Level 6
How do I fix that?

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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