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.
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.
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.
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.
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
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.
@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.
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
This means that your original dataset in library HW4 is already empty.
If that dataset is the result of previous codes, rerun them. If it was imported, repeat the import process.
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
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.
Ready to level-up your skills? Choose your own adventure.