BookmarkSubscribeRSS Feed
Mel120585
Fluorite | Level 6

Hi All,

 

I am trying to debug a code developed by someone else and have got stuck on the following section of code:

 

data mydata.finalpermin;
set nwsleep;
drop asleepnw addnwid nwinsleep;
format finalnw yesno. finalsleep yesno. sleepnwidentifier yesno.;
label finalnw = "Identifier for minute of non-wear (yes/no)" finalsleep = "Identifier for
minute of sleep (yes/no)"
sleepnwidentifier = "Identifier for minute of sleep OR non-wear (yes/no)"
Steps = "Total steps for the minute processed with Low Frequency Extension OFF" Paxn =
"Sequential Minute"
Paxinten = "Total intensity counts in the vertical axis for the minute"
Axis2 = "Total intensity counts in the anterior-posterior axis for the minute"
Axis3 = "Total intensity counts in the medial-lateral axis for the minute"
slpperiod = "Sequential sleep period" wkperiod = "Sequential wake period";
run;

 

It comes up with the following error:

ERROR 48-59: The format YESNO was not found or could not be loaded.

 

I have tried putting in a Proc format as follows but it still comes up with the error above:

 

Proc format;
value $ yesno.
"0" = "no"
"1" = "yes"
;

 

Can anyone help me please?

 

Many thanks,

 

Mel

7 REPLIES 7
RW9
Diamond | Level 26 RW9
Diamond | Level 26

The format in question: YESNO.

Is a numeric format not a character format, so change your proc format to be:

Proc format;
  value yesno
    0 = "no"
    1 = "yes";

run;

Mel120585
Fluorite | Level 6

Thank you very much. It seems to have worked but has thrown up another error now from the following code:

 

proc sort data=bed1 nodupkey dupout=mult out=newbed;
by pid noon;
run;

 

It gives: 

 

Syntax error, expecting one of the following: ;, (, ASCII, BUFFNO, DANISH, DATA,
DATECOPY, DETAILS, DIAG, EBCDIC, EQUALS, FINNISH, FORCE, IN, ISA, L, LEAVE, LIST,
MESSAGE, MSG, NATIONAL, NODUP, NODUPKEY, NODUPKEYS, NODUPLICATE, NODUPLICATES,
NODUPREC, NODUPRECS, NODUPS, NOEQUALS, NORWEGIAN, NOTHREADS, OSA, OUT, PAGESIZE,
PSIZE, REVERSE, SIZE, SORTSEQ, SORTSIZE, SORTWKNO, SWEDISH, T, TAGSORT, TECH,
TECHNIQUE, TESTHSI, THREADS, WKNO, WORKNO.
ERROR 76-322: Syntax error, statement will be ignored.

 

I have checked online but it seems that this statement is written correctly. Could you give any suggestions as to what I am missing please?

 

Sorry to ask another question.

 

Thanks

 

Mel

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Well, I can't see a problem with that code directly (and can't test now as not at work), but can you post the log, the step prior to this sort, and all the ways up to the end of the error - exactly the log.  Am wondering if something before the sort is causing a problem.  you could also try changing the position of the proc's parameters, e.g move out= before the nodupkey.

Astounding
PROC Star

The code you posted looks correct, but the error indicates that you probably left off the semicolon at the end of the PROC SORT statement.

Mel120585
Fluorite | Level 6

I have tried putting a semincolon in and that didn't help and I have tried moving the order around and the same error keeps coming up. Below is the code above and below where the error is occuring:

 

proc sort data= mydata.finalpermin;
by pid slpperiod paxn ;
run;
data bed1;
set mydata.finalpermin;
where finalsleep = 1 and noon ge 1 and noon < 7;
run;
proc sort data=bed1 nodupkey dupout=mult out=newbed;
by pid noon;
run;
data bed2;
set newbed;
bedtime = acceltime;
format bedtime time8.2;
keep pid noon bedtime;
run;
proc sort data = bed1;
by pid slpperiod descending paxn;
run;

Any help appreciated!

 

Thanks

 

Mel

Kurt_Bremser
Super User

The log would be more helpful, as the position of the ERROR message is a good guide on the way to finding the offending location in the code.

Ksharp
Super User

Try add a system option .

 

options nofmterr;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

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.

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
  • 7 replies
  • 1849 views
  • 0 likes
  • 5 in conversation