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

I have a dataset like this
Id var cat n value
1 var1 cat1 1 A
2 var2 cat2 2 B
3 var3 cat3 1 C
4 var4 cat1 1 A
5 var5 cat2 2 B
6 var6 cat3 2 C
7 var7 cat1 1 A
8 var8 cat2 1 B
9 var9 cat3 2 C


The required o/ p looks like this

                        A                         B                                C
                 N=1    n=2            n=1     n=2                n=1      n=2
Cat1
Var1      xx (xx)  xx(xx)       xx (xx)  xx(xx)       xx (xx) xx(xx)

Var4      xx (xx)  xx(xx)       xx (xx) xx(xx)       xx (xx) xx(xx)
Var7     xx (xx)  xx(xx)       xx (xx) xx(xx)       xx (xx) xx(xx)
Cat2
Var2     xx (xx)  xx(xx)       xx (xx) xx(xx)       xx (xx) xx(xx)
Var5     xx (xx)  xx(xx)       xx (xx) xx(xx)       xx (xx) xx(xx)
Var8      xx (xx)  xx(xx)       xx (xx) xx(xx)       xx (xx) xx(xx)
Cat3
Var3      xx (xx)  xx(xx)       xx (xx) xx(xx)       xx (xx) xx(xx)
Var6      xx (xx)  xx(xx)       xx (xx) xx(xx)       xx (xx) xx(xx)
Var9      xx (xx)  xx(xx)       xx (xx) xx(xx)       xx (xx) xx(xx)

Where xx(xx) refers to counts of each var with percentages in braces.
Someone please help me with a soln.
Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ
Hi:
It looks to me like you want some type of demograhic report, possibly with the N and PCTN like N (PCTN) -- when you need to concatenate statistics, you need to do more than just transpose PROC FREQ output, you usually need to perform some other data manipulation.

I wonder whether your desired report is actually correct, you have three values of A, B, C and 2 values of N 1 and 2 so if you are nesting N under VALUE, then you should have 6 columns across, but you only have 5.

I think this paper might help you. Look at example 1 and example 8 in the paper.https://support.sas.com/resources/papers/proceedings/pdfs/sgf2008/173-2008.pdf

Cynthia

View solution in original post

5 REPLIES 5
PaigeMiller
Diamond | Level 26

 

My eyes don't really relate to the desired solution you have typed. I can't grasp it unless you type it in with appropriate spacing so it actually looks like a real table that SAS might output.

 

I suggest you spend some time providing such a properly spaced output that looks like an actual table by typing what you want into the window that appears when you click on the {i} icon, which will preserve the spacing, and make the results look like an actual table.

--
Paige Miller
AKHILA
Obsidian | Level 7

2019-04-22-19-59-04-142.jpg

 

hi ,

This is the mock o/p.Values i have written are not accurate but it should follow the same format throughout.

how can i do this?

 

Cynthia_sas
SAS Super FREQ
Hi:
It looks to me like you want some type of demograhic report, possibly with the N and PCTN like N (PCTN) -- when you need to concatenate statistics, you need to do more than just transpose PROC FREQ output, you usually need to perform some other data manipulation.

I wonder whether your desired report is actually correct, you have three values of A, B, C and 2 values of N 1 and 2 so if you are nesting N under VALUE, then you should have 6 columns across, but you only have 5.

I think this paper might help you. Look at example 1 and example 8 in the paper.https://support.sas.com/resources/papers/proceedings/pdfs/sgf2008/173-2008.pdf

Cynthia
AKHILA
Obsidian | Level 7

Hi mam,

           I have edited my post.Hope that is in a proper way to understand.

Ksharp
Super User

It looks like a STDM report.

Here is an example , Hope you could learn something from it.

 

https://communities.sas.com/t5/SAS-Programming/Table-format-final-output/m-p/552646#M153624

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
  • 5 replies
  • 693 views
  • 1 like
  • 4 in conversation