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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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