BookmarkSubscribeRSS Feed
SasStudent2
Fluorite | Level 6

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

5 REPLIES 5
Reeza
Super User

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


 

SasStudent2
Fluorite | Level 6
THANK YOU SO MUCH! I hate those semicolons.
novinosrin
Tourmaline | Level 20

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

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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? 

ballardw
Super User

@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.

 

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!

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
  • 640 views
  • 3 likes
  • 5 in conversation