BookmarkSubscribeRSS Feed
larkjr18
Fluorite | Level 6

Create a SAS data set for observations starting with the 10th and ending with the 40th based on the female-master-applicant data set, which you have created for item 5. Use the appropriate data set option and the assignment statement or the SUM statement to calculate the average GPA (Ave_GPA) for those 31 students. Show the average GPA (i.e., the value of the Ave_GPA variable) from SAS Log or PROC PRINT output.

 

This is the general code I have right now:

 

data hi.femalesq6;
infile 'C:\Users\larkj\Desktop\STUDENT.DAT';
input SSN 1-9 sex $ 11 type $ 19 GPA 50-53;

run;
proc print data=hi.femalesq6(firstobs= 10 obs=40);
where sex='F' and type='M';
run;

 

When I add some kinda sum statement it just seems to create a new variable and print the same numbers as the gpa.

3 REPLIES 3
Reeza
Super User

@larkjr18 wrote:

Create a SAS data set for observations starting with the 10th and ending with the 40th based on the female-master-applicant data set, which you have created for item 5. Use the appropriate data set option and the assignment statement or the SUM statement to calculate the average GPA (Ave_GPA) for those 31 students. Show the average GPA (i.e., the value of the Ave_GPA variable) from SAS Log or PROC PRINT output.

 

This is the general code I have right now:

 

data hi.femalesq6;
infile 'C:\Users\larkj\Desktop\STUDENT.DAT';
input SSN 1-9 sex $ 11 type $ 19 GPA 50-53;

run;
proc print data=hi.femalesq6(firstobs= 10 obs=40);
where sex='F' and type='M';
run;

 

When I add some kinda sum statement it just seems to create a new variable and print the same numbers as the gpa.


Proc means

larkjr18
Fluorite | Level 6

When I tried proc means yesterday it didn't work. Here is my code for it.

 

proc means data=hi.femalesq6(firstobs=10 obs=40);
where sex='F' and type='M';
by GPA;
run;

 

Also posted a picture of the output.


2017-03-30 (1).png
larkjr18
Fluorite | Level 6

Just figured out that I had by and not var thank you for the help though.

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 3 replies
  • 1460 views
  • 0 likes
  • 2 in conversation