Help using Base SAS procedures

Need help to create a table, probably with proc tabulate

Reply
New Contributor
Posts: 3

Need help to create a table, probably with proc tabulate

[ Edited ]

Hi there,

 

I need to create a table (se attached Excel file showing how the table should look at the en). I have data (se attached Excel fil representing the data source with the variables I need to analyse). 

 

I think it should work with proc tabulate, but I am not sure how to use it. I the dataset the variable "Vikt" must be use according to the Freq statement. 

 

I will be grateful for your help Smiley Happy

 

Thanks

/MCB

SAS Super FREQ
Posts: 9,371

Re: Need help to create a table, probably with proc tabulate

Hi,

  A lot of folks don't like to open Excel files. What code have you tried? How do you read your data? It is usually a good idea to post code in plain text format in the form of a DATA step so people can copy your program to make data or do a sample dataset using the SASHELP data, which everyone has. The code icon (little notebook with the running man icon) allows you to post code without having the Forum re-format the code.

 

Cynthia

New Contributor
Posts: 3

Re: Need help to create a table, probably with proc tabulate

Posted in reply to Cynthia_sas
Hi,

Thank you Cynthia. I understand the problem with Excel. I solved my problem in different way, but I was thinking my way was not very effective and I guess the Proc tabulate could have been a smoother solution. However, I can try to follow your instructions next time.

Thanks,
Marcela
Super User
Posts: 13,583

Re: Need help to create a table, probably with proc tabulate

How do we tell from your data which are people with deduction of tax for pension? In terms of the variables in your "data"

You have column heading like:

Deduction of Tax for pension savings    
0-1,2 1,2-2,4 2,4-6,0 6,0-12,0 12,0-

but there is not an obvious connection to the values of the "deduction" variable which are more in the 4500, 12000 or 17000 values. How do they map to that row of values?

 

You also show in your desired table:

Where by Category :
1
2
3

What does that mean? Or that supposed to be the category variable is also used as a row header?

 

Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.

 

You might want to include labels so we know which variable may represent "people".

New Contributor
Posts: 3

Re: Need help to create a table, probably with proc tabulate

Hello!
Thank you for responding. The deduction 0-1,2, 1,2-2,4 and so on are intervals of the variable Deduction in the dataset that showed appear in the final table. For example 1,2 =12000 in the dataset. An observation of the variable Deduction in the dataset that equals 0 should not be included in the interval 0-1,2 in the final table. The variable Category 1=Youth, 2=Meddle age 3=Pensioners. I hope things are more clear now.
Ask a Question
Discussion stats
  • 4 replies
  • 106 views
  • 0 likes
  • 3 in conversation