Help using Base SAS procedures

data numeric, but variable actually categorical

Reply
Contributor
Posts: 58

data numeric, but variable actually categorical

Hello,
I'm using proc logistic and have several categorical variables. The data, though, is numeric, some with corresponding formats, others binary, etc. Is there an easy way to get proc logistic to recognize the variables as categorical? I tried to list them under class, but this didn't work of course since the data is numeric. Do i simply have to reformat the info? How do i do this in an efficient manner?
N/A
Posts: 0

Re: data numeric, but variable actually categorical

CLASS works with numeric or character. However, if you want to group numeric variables into grouped classes you will need to generate a user format. Here is an example:

PROC FORMAT;
value classit low-25 = '-25'
25<-60 = '25 <- 60'
60 - high = '60+'
;
run;

proc logistic data=yourdata descending;
class num_class;
format num_class clasit.;
model whatever = other_numeric | class @ 2;
run; Message was edited by: jonas.bilenas
N/A
Posts: 0

Re: data numeric, but variable actually categorical

Posted in reply to deleted_user
Hmm, My response looks truncated. Is there a word limit here?
Regular Contributor
Posts: 165

Re: data numeric, but variable actually categorical

Posted in reply to deleted_user
SAS Super FREQ
Posts: 8,862

Re: data numeric, but variable actually categorical

Posted in reply to deleted_user
Hi:
No, no word limit, but special characters like < and > sometimes confuse the forum posting editor...because it uses HTML tags and < and > are looking like HTML and so sometimes pieces of your post get "truncated" while the editor looks for the end of a tag.

Here's the specifics:
http://support.sas.com/forums/thread.jspa?messageID=27609毙

Use the [pre] and [/pre] tags around your code and output in order to maintain indenting and spacing. And, also, use &lt; for < symbol and &gt; for > symbol.

cynthia
Contributor
Posts: 58

Re: data numeric, but variable actually categorical

Posted in reply to deleted_user
Great. Thanks all! I think i was forgetting to put my values in single quotes. Silly rabbit . . .
Ask a Question
Discussion stats
  • 5 replies
  • 146 views
  • 0 likes
  • 4 in conversation