BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
vijay24
Calcite | Level 5
edu_lvl Frequency Percent CumulativeFrequency CumulativePercent123456
160.26160.26
65510.8067111.06
1823.0085314.06
5739.45142623.51
225437.16368060.68
238539.326065100.00

 

My variable name is education level. Considering low responses I want to add levels '1' and '2' together. help, please.

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

the easiest way might be to create a format that combines those two values.  Assuming the values are numbers then the format definition might look like:

proc format ;
value edu_combo
  1,2 = '1 or 2'
;
run;

Then just use that format with your PROC .

proc freq data=mydata ;
  tables edu_lvl;
  format edu_lvl edu_combo.;
run;

View solution in original post

5 REPLIES 5
vijay24
Calcite | Level 5

Something messed up. obs 1  = 16 and obs 2 = 655. I want to combine them into one observation.

PeterClemmensen
Tourmaline | Level 20

So given this data, what does your desired result look like?

PaigeMiller
Diamond | Level 26

@vijay24 wrote:
Considering low responses I want to add levels '1' and '2' together. 

I don't understand this sentence.

 

Please show us the results you want from this data.

 

In addition, it is best if you provide the data in a readable form, prefereably as a SAS data step, instructions are here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat...

--
Paige Miller
Tom
Super User Tom
Super User

the easiest way might be to create a format that combines those two values.  Assuming the values are numbers then the format definition might look like:

proc format ;
value edu_combo
  1,2 = '1 or 2'
;
run;

Then just use that format with your PROC .

proc freq data=mydata ;
  tables edu_lvl;
  format edu_lvl edu_combo.;
run;
vijay24
Calcite | Level 5

@Tom  Thank you so much. This worked perfectly fine. 

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
  • 5 replies
  • 851 views
  • 3 likes
  • 4 in conversation