BookmarkSubscribeRSS Feed
yadalsa
Calcite | Level 5

Hi Team,

Iam using Proc Report for creating a table. I have created a small dataset. i have 4 levels of a variable (L,P,S,W) and then sub_types within each level

O,V,U

the desired output is attached. Iam trying to find frequencies of only the 1's, Iam not interested in the 0's

Also, is there a way to output the data in a desired fashion, for eg.,

i want par6, par7 and part8 to be followed by part1 etc.,

 

Thank you,

 

1 REPLY 1
ballardw
Super User

Didn't realize this was a partial duplicate post. And one of the reasons we recommend NOT posting duplicates. You left out the required appearance in this thead.

Also, frequencies represent counts and your previous post shows that you want %.

You may need to be more explicit about what you mean by " want par6, par7 and part8 to be followed by part1 " as there is no variable indicated to be Part1. The order of your variables in a report procedure will likely do what you want.

 

Basic approach with many of the report or summarization procedures is to SUM or Mean (for percent) the variable of interest.

I'm not going to do all of the manipulation to get something into the body of table that doesn't exist in your data the  CC and EL parts.

 

proc tabulate data=have;

class type sub_type;

var par: ;

table par1_cc par2_cc,

         type * subtype * mean='%';

 

run;

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!

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.

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
  • 954 views
  • 0 likes
  • 2 in conversation