Hi,
I am new to SAS and have managed to download SAS 9.0 to try and run a code I have been provided to analyse some data. However, it is getting stuck at the following point:
data libname.pampermin;
set sets;
ProbSleep = 7.601 - (0.065*MeanW5) - (1.08*sumind) - (0.056*STDpre5) -
(0.703*logact);
if probsleep = . THEN DO; PROBSLEEP = 1; END;
if probsleep < 0 and probsleep ne . then SleepIncOff = 0; if (probsleep ge 0) or
inclinometer = 0 then SleepIncOff = 1;
drop lastpax time;
run;
When it gets to this section, it comes up with "ERROR: Libname LIBNAME is not assigned." This is the first time in the code that Libname is referred to. I have tried to read other threads on this to do with assigning a pathway but can't make any progress. Could anyone give me some suggestions as to how I resolve this issue please?
Many thanks,
Mel
You need to have a statement that maps the LIBNAME to the path where your data resides.
Ex:
libname libname "C:\projects\mydata";
BTW, I suggest you don't use libname as the name of the library - will confuse you more.
libname mydata "C:\projects\mydata";
data mydata.pampermin;
set sets; /* this is going to be in your WORK library. Does the data exist? */
ProbSleep = 7.601 - (0.065*MeanW5) - (1.08*sumind) - (0.056*STDpre5) -
(0.703*logact);
if probsleep = . THEN DO; PROBSLEEP = 1; END;
if probsleep < 0 and probsleep ne . then SleepIncOff = 0; if (probsleep ge 0) or
inclinometer = 0 then SleepIncOff = 1;
drop lastpax time;
run;
You need to have a statement that maps the LIBNAME to the path where your data resides.
Ex:
libname libname "C:\projects\mydata";
BTW, I suggest you don't use libname as the name of the library - will confuse you more.
libname mydata "C:\projects\mydata";
data mydata.pampermin;
set sets; /* this is going to be in your WORK library. Does the data exist? */
ProbSleep = 7.601 - (0.065*MeanW5) - (1.08*sumind) - (0.056*STDpre5) -
(0.703*logact);
if probsleep = . THEN DO; PROBSLEEP = 1; END;
if probsleep < 0 and probsleep ne . then SleepIncOff = 0; if (probsleep ge 0) or
inclinometer = 0 then SleepIncOff = 1;
drop lastpax time;
run;
I'm sorry to ask yet another question but it is now saying that there is a syntax error in the following:
if wake1 < bed1 then; SleepNWmins = ((wake1 + ('24:00:00't bed1))+'00:01:00't)/60;
I am trying to find the missing syntax but is it obvious to everyone else?!
Thanks again,
Mel
Hi @Mel120585,
No problem. This forum is a great place for asking questions. Best practice is to open a new thread for a new question.
I think, there are two errors in your code:
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.