Help using Base SAS procedures

Proc tranpose help

Reply
Occasional Contributor
Posts: 5

Proc tranpose help

Hello, 

i have to Make a demographic table with three different groups. I’m having trouble with the age group. I used Proc Univariate to then transpose. I don’t understand why I keep getting this error message. Am I missing something obvious? Sorry but I’m new to all this! Thank you in advance for your help.

image.jpgimage.jpg

Super User
Posts: 23,752

Re: Proc tranpose help

Posted in reply to SasStudent2

You forgot the semicolon at the end of your BY statement, so SAS thinks VAR is another variable, not a new statement.

 


@SasStudent2 wrote:

Hello, 

i have to Make a demographic table with three different groups. I’m having trouble with the age group. I used Proc Univariate to then transpose. I don’t understand why I keep getting this error message. Am I missing something obvious? Sorry but I’m new to all this! Thank you in advance for your help.

image.jpgimage.jpg


 

Occasional Contributor
Posts: 5

Re: Proc tranpose help

THANK YOU SO MUCH! I hate those semicolons.
PROC Star
Posts: 1,817

Re: Proc tranpose help

Posted in reply to SasStudent2

@SasStudent2 Kindly mark @Reeza'ssolution as answered and close the thread.  Although, nice of you to acknowledge the help with a "thank you"

Super User
Super User
Posts: 9,599

Re: Proc tranpose help

Posted in reply to SasStudent2

Answer me one question first if you will, is taking a photo of your screen and uploading pictures to the forum easier than simply copy and pasting some text? 

Super User
Posts: 13,563

Re: Proc tranpose help

Posted in reply to SasStudent2

@SasStudent2 wrote:

Hello, 

i have to Make a demographic table with three different groups. I’m having trouble with the age group. I used Proc Univariate to then transpose. I don’t understand why I keep getting this error message. Am I missing something obvious? Sorry but I’m new to all this! Thank you in advance for your help.

 


What specific trouble are you having with the agegroup?

 

If the whole purpose of this exercise is to make a report table consider one of the report procedures like Proc Tabulate or Proc Report which will both do simple statistics and grouping.

 

It is always a good idea to provide a little example data so we know what variables you have, what type they are and the structure of your data set.

 

Guessing here but I might start with

proc tabulate data=demog;
   class trt;
   class race;
   class gender;
   var age;
   table (race gender)*(n mean std max min),
         trt* age
         ;
run;

Grouping is done by values of the class variables in proc tabulate, so each value of race and gender in this example, will have the statistics calculated for age under a column for each level of the trt variable. Different orders of values can be accomplished with moving class variables from row to column and the group of statistics.

 

Ask a Question
Discussion stats
  • 5 replies
  • 110 views
  • 3 likes
  • 5 in conversation