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

 

Hello, everything,

 

Is it possible to create a format from the dataset? 

 

Here is my data: 2 variables, 1st one "symptom" is a character variable, 2nd one "category" is numerical.

 

I want to format category by the value of symptom.

 

Instead of creating by hand using proc format, is there any easy way to do it? since I have many datasets, like this one. 

 

Symptom category
Anorexia      1
Cachexia     2
Dizziness      3
Fever/Pyrexia 4
Malaise 5
Obesity 6
Orthostatic hypotension 7
Syncope 8
Underweight 9

 

Thanks a lot!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
bobpep212
Quartz | Level 8

You add a column to the dataset that will be your format name. Then, you rename the value to LABEL and symptom to START (or vice versa, whichever way you are going). Then proc format with cntlin=ds_name option.

 

http://www2.sas.com/proceedings/forum2007/068-2007.pdf

 

 

View solution in original post

4 REPLIES 4
data_null__
Jade | Level 19
Yes. Everything you need to know is in the online documentation for PROC FORMAT. See CNTLIN proc statement option.
bobpep212
Quartz | Level 8

You add a column to the dataset that will be your format name. Then, you rename the value to LABEL and symptom to START (or vice versa, whichever way you are going). Then proc format with cntlin=ds_name option.

 

http://www2.sas.com/proceedings/forum2007/068-2007.pdf

 

 

qiali
Calcite | Level 5
Thank you so much for your quick reply!!!

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 4 replies
  • 1369 views
  • 0 likes
  • 4 in conversation