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

Hi there,

I'm new to SAS and am using SAS Enterprise Miner 14.1.

My problem is pretty simple (but so am ISmiley Happy).

I have a variable "month" that can take the values Jan, Feb, Mar ... Dec but I want to create a new numeric variable from that, let's call it nmonth, that is = 1 if month=Jan, =2 if month = Feb etc.

The Help suggests Expression Builder seems to be the way to go but how do I get to this (if indeed this is the best way to go)?

Regards

Confused

1 ACCEPTED SOLUTION

Accepted Solutions
MikeZdeb
Rhodochrosite | Level 12

Hi, here's a data step attempt (still an Enterprise Guide holdout).  The variable NEW is NUMERIC ...

data x;

input old :$3. @@;

datalines;

JAN MAR OCT DEC

;

data x;

set x;

new = input(put(input(catt(old,'1960'),monyy.),month.),2.);

run;

DATA SET x

Obs    old    new

1     JAN     1

2     MAR     3

3     OCT    10

4     DEC    12

View solution in original post

2 REPLIES 2
MikeZdeb
Rhodochrosite | Level 12

Hi, here's a data step attempt (still an Enterprise Guide holdout).  The variable NEW is NUMERIC ...

data x;

input old :$3. @@;

datalines;

JAN MAR OCT DEC

;

data x;

set x;

new = input(put(input(catt(old,'1960'),monyy.),month.),2.);

run;

DATA SET x

Obs    old    new

1     JAN     1

2     MAR     3

3     OCT    10

4     DEC    12

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 2 replies
  • 11324 views
  • 2 likes
  • 2 in conversation