BookmarkSubscribeRSS Feed
marjo11
Calcite | Level 5

Hello everyone, 

I'm currently a student taking a data analysis class and I'm currently doing my second assignment for the class. however, I have an issue with the 2nd part of my code since it tells me that the variable cluster is not found and yet, I have tried to add it on at the beginning of my code but then it makes the whole code useless. I have tried for hours to figure it out, but it seems that I'm unable to find my mistake per se. the second part of my code is supposed to : "develop a model to classify future visitors in one of your clusters using the variables "age" and "sex" only, without any transformations or model selection". And here is my current code that work up until the section that says question b. my code is the attached document. 

 

3 REPLIES 3
PaigeMiller
Diamond | Level 26

Please include your code in your message, instead of including code as an attachment.

 

Since it appears that you have received an error message, please also show us the log (in the message, not as an attachment), showing the every line of the log for the PROC or DATA step which has the error.  

--
Paige Miller
hollandnumerics
Pyrite | Level 9
While your code is readable, your data is not. Therefore, as frequently requested here and I hope you have also read it, please include a copy of your program log, as it will detail the errors and, possibly, offer suggestions too!
Philip R Holland
Recent book (see my blog site): "SAS Programming Experiences: A How-To Guide from a Power SAS User"
Quentin
Super User

SAS language is run in steps, DATA steps and PROC steps, which is helpful when debugging, because you can run one step at a time, and focus on the first step that generates an error.

 

Which step in your code is generating the error, is it this one (I'm just guessing, from your description):

proc logistic data=ps2q2 outmodel=model_out;
  class cluster (ref='1'); /* Set reference cluster */
  model cluster = age sex;
run;

If so, please post the log you get from running that step, showing the code in the step, and all the error messages.

 

I noticed your earlier code reads a dataset econ324.ps2q2.  That means there is a dataset named ps2q2, which exists in a SAS library named econ324.  

 

So possibly the above code should be:

proc logistic data=econ324.ps2q2 outmodel=model_out;
  class cluster (ref='1'); /* Set reference cluster */
  model cluster = age sex;
run;

Also, just glancing at your earlier code, I noticed you read in the dataset econ324.ps2q2 and create a new dataset named temp, which you use as input to PROC MEANS:

data temp;
    set econ324.ps2q2;
run;
                                               
proc means data=temp;
    var ressext culture actext nightlife;
run;

You don't need create the temp dataset, you can just code PROC MEANS like:

proc means data=econ324.ps2q2;
    var ressext culture actext nightlife;
run;

 
In my experience as a student (a long time ago : ) it's hard to learn the SAS language and statistics at the same time.  I was lucky to be in a school that taught a SAS language class in parallel to the statistics classes.  You might want to ask your instructor, teaching assistant, or other students about resources for learning the basics of the SAS language that will be needed to support your work in the class.

The Boston Area SAS Users Group is hosting free webinars!
Next webinar will be in January 2025. Until then, check out our archives: https://www.basug.org/videos. And be sure to subscribe to our our email list.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 324 views
  • 0 likes
  • 4 in conversation