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

Okay first of all.....if you saw my last post, no you didn't. ANYWAYS.....

 

I'm trying to run a logistic regression with proc surveylogistic and I'm having trouble setting my reference levels for the different variables. Here is my code:

proc surveylogistic data=masks1;
weight wt_multi;
class d_age_cat2 (ref=”0”) d_gender (ref=”MALE”) d_race (ref=”NH White”) d_politics (ref=”DEM“) d_religion2 (ref=”NOTHING”) vaxxed (ref=”0”);
model b2_m_always (descending) = d_age_cat2 d_gender d_race d_politics d_religion2 vaxxed;
run;
And here is the error message I get:
 
103        
 104        proc surveylogistic data=masks1;
 105        weight wt_multi;
 106        class d_age_cat2 (ref=”0”) d_gender (ref=”MALE”) d_race (ref=”NH White”) d_politics (ref=”DEM“)
                                  _______                __________              _____                           _________
 _____________                                                                                                                       
                                  22                     22                      22                              22
 22
                                  202                    202                     202                             202
 202
 106      ! d_religion2 (ref=”NOTHING”) vaxxed (ref=”0”);
 106        class d_age_cat2 (ref=”0”) d_gender (ref=”MALE”) d_race (ref=”NH White”) d_politics (ref=”DEM“)
 106      ! d_religion2 (ref=”NOTHING”) vaxxed (ref=”0”);
                                                        _______
                                                        22
 ERROR 22-322: Syntax error, expecting one of the following: a quoted string, FIRST, LAST.  
 
 ERROR 202-322: The option or parameter is not recognized and will be ignored.
 
 106        class d_age_cat2 (ref=”0”) d_gender (ref=”MALE”) d_race (ref=”NH White”) d_politics (ref=”DEM“)
 106      ! d_religion2 (ref=”NOTHING”) vaxxed (ref=”0”);
                                                        _______
                                                        202
 ERROR 202-322: The option or parameter is not recognized and will be ignored.
 
Please help! Proc surveylogistic has been killing me lately. Thanks in advance. 
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
Did you copy and paste that from
somewhere? The quotation marks appear a bit messed up - try retyping the code and make sure to use the formatted reference values. Also, put the weight statement after the CLASS statement.

I suspect the only issue is the quotation marks being messed up though.

View solution in original post

3 REPLIES 3
Reeza
Super User
Did you copy and paste that from
somewhere? The quotation marks appear a bit messed up - try retyping the code and make sure to use the formatted reference values. Also, put the weight statement after the CLASS statement.

I suspect the only issue is the quotation marks being messed up though.
joachimg
Obsidian | Level 7
You know, I knew it was gonna be something dumb like that. Thanks!

Can I ask why move the weight statement? Seems to be working fine, and that's how my PI had me do it. Just curious.
Reeza
Super User
I’m in the habit of putting them in the order as it shows in the docs. There’s a few good reasons for this - makes it easier to read your code and if you use patterns for coding updates and fixes are easier. Following the doc order is something most SAS programmers do so its a good way to have consistent clean code. For some procs/statements the order does matter as well, and I can never remember which ones so defaulting to keeping them in order works in general.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

SAS Enterprise Guide vs. SAS Studio

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 3 replies
  • 1046 views
  • 1 like
  • 2 in conversation