BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
abrianaj
Calcite | Level 5

My data is birthweight vs gestation length for a class. 666 observations. I'm using the SAS university version and I can't figure out how to get the errors to go away. I have tried removing the 'g', removing the word 'under', taking out extra spaces. I just checked the data and there are no holes. Although my frequency table says I'm missing 1 value. I need to export my new data set with my new variables and their categories, but I an getting this error and the categories are not populating in to my new data set.

 

My input:

DATA BIOSTAT.CPD4;
SET BIOSTAT.CPD;
LABEL Under 1000g = "Under 1000 (grams)"
		Over 1000g = "Over 1000 (grams)"
		Under 800g = "Under 800 (grams)"
		800g-1200g = "800 - 1200 (grams)"
		Over 1200g = "Over 1200 (grams)"
		22-31 weeks = "Under 31 weeks"
		31-40 weeks = "Over 31 weeks"
		22-27 weeks = "Under 27 weeks"
		27-31 weeks = "27-31 weeks"
		31-40 weeks = "Over 31 weeks";
RUN;

 Info from the log page:

911  DATA BIOSTAT.CPD4;
912  SET BIOSTAT.CPD;
913  LABEL Under 1000 = "Under 1000 (grams)"
                 ----
                 73
                 200
ERROR 73-322: Expecting an =.

ERROR 200-322: The symbol is not recognized and will be ignored.

914          Over 1000g = "Over 1000 (grams)"
915          Under 800g = "Under 800 (grams)"
916          800g-1200g = "800 - 1200 (grams)"
917          Over 1200g = "Over 1200 (grams)"
918          22-31 weeks = "Under 31 weeks"
919          31-40 weeks = "Over 31 weeks"
920          22-27 weeks = "Under 27 weeks"
921          27-31 weeks = "27-31 weeks"
922          31-40 weeks = "Over 31 weeks";
923  RUN;

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set BIOSTAT.CPD4 may be incomplete.  When this step was stopped there were 0
         observations and 5 variables.
WARNING: Data set BIOSTAT.CPD4 was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.06 seconds
      cpu time            0.00 seconds

Please let me know if I'm completely screwing this up. It's due on this coming Friday.

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

In the label statement, you have to give actual (valid) SAS variable names.

 

Under 1000g is not a valid SAS variable name. Valid SAS variable names cannot have spaces in them. You might want to do a PROC CONTENTS to find what the actual variable names are in BIOSTAT.CPD4

--
Paige Miller

View solution in original post

5 REPLIES 5
PaigeMiller
Diamond | Level 26

In the label statement, you have to give actual (valid) SAS variable names.

 

Under 1000g is not a valid SAS variable name. Valid SAS variable names cannot have spaces in them. You might want to do a PROC CONTENTS to find what the actual variable names are in BIOSTAT.CPD4

--
Paige Miller
Rick_SAS
SAS Super FREQ

The LABEL statement has the syntax

LABEL varname = "string";

You are getting errors because you are not specifying the name of a SAS variable. To find the names of the variables, use

 

PROC CONTENTS data=BIASTAT.CPD sort;

run;

 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

I would really suggest you take some basic SAS lessons, maybe watch the SAS videos.  This is a very basic question.  Using the Label statement in your datastep is to label variables.  It has the form:

label <variablename> <labeltext> [<variablename> <labeltext>];

This:

LABEL Under 1000g = "Under 1000 (grams)"

Does not conform to that at all, as Under 1000g is not a valid SAS variable Name.  Without further information as to what you are attempting its hard to say, but I would think the variable with the label "Under 1000g" has a name, and it is this name you need to put there, say it was called  

abrianaj
Calcite | Level 5

I literally just found out about this program for school in August. Basic questions lead to easy answers, no? Thanks for your help 🙂 

SAS_Rob
SAS Employee

You might also want to take a look at Proc FORMAT as well.  It seems that may be what you are looking for.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 6407 views
  • 2 likes
  • 5 in conversation