BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hello

I am trying to create a dataset from an existing dataset.

The current dataset has a variable called id_code. The id_code is a string of length 10 characters. I need to extract the 2 left most characters and based on whether it is a 01 assign "temp" and if 02 assign "non-temp".

I have to repeat this process till the end of the dataset that has around 350 observations.

Could anyone help me with the code for this.

Thanks
1 REPLY 1
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
This is basic DATA step IF THEN ; logic.

Have a look at the SAS-hosted DOC and supplemental references on their SAS.COM support website - links revealed with search below. Then come back to the forum again with code challenges/issues -- suggest using the SAS diagnostic code below to reveal much info:

PUTLOG _ALL_;

Scott Barry
SBBWorks, Inc.

Recommended Google advanced search arguments, this topic/post:

data step programming introduction site:sas.com

data step assign sas variable site:sas.com

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1 reply
  • 964 views
  • 0 likes
  • 2 in conversation