BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
hundohoppip
Calcite | Level 5
Im a brand new sas user. Im suppose to do the following but Im stuck on part C.

Calculate total points of homework and quizzes

a. Subset homework and quizzes from class data sets as HQ data sets (say, HQ1, etc.) along with
student ID variable.
b. Use Proc Transpose to transpose the data set HQ1 by student_ID, so we can rank (or sort)
homework and quizzes scores for each student later.


c. Keep only two variables: student ID and “scores of homework and quizzes” from Proc
transpose.

d. Sort the resulting data set in step c such that each student’s 17 to 20 scores of homework and
quizzes are ranked from high to low

e. Transpose data back into the original format, and don’t worry about variable names

code attached

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@hundohoppip wrote:
Im a brand new sas user. Im suppose to do the following but Im stuck on part C.

Calculate total points of homework and quizzes

a. Subset homework and quizzes from class data sets as HQ data sets (say, HQ1, etc.) along with
student ID variable.
b. Use Proc Transpose to transpose the data set HQ1 by student_ID, so we can rank (or sort)
homework and quizzes scores for each student later.


c. Keep only two variables: student ID and “scores of homework and quizzes” from Proc
transpose.

d. Sort the resulting data set in step c such that each student’s 17 to 20 scores of homework and
quizzes are ranked from high to low

e. Transpose data back into the original format, and don’t worry about variable names

code attached

 


Any time you create a data set in SAS you can add options to Keep or Drop variables.

An example you should be able to run:

Proc sort data=sashelp.class
              out= work.class(keep= name sex age)
;
   by sex age;
run;

The options go inside parentheses after the name of the data set. The data set options can be used with just about any data set. There are some interactions between Keep/ Drop and Rename (yes you can change the name of variable just before/after use) in the same option as to which name to keep when renaming.

View solution in original post

1 REPLY 1
ballardw
Super User

@hundohoppip wrote:
Im a brand new sas user. Im suppose to do the following but Im stuck on part C.

Calculate total points of homework and quizzes

a. Subset homework and quizzes from class data sets as HQ data sets (say, HQ1, etc.) along with
student ID variable.
b. Use Proc Transpose to transpose the data set HQ1 by student_ID, so we can rank (or sort)
homework and quizzes scores for each student later.


c. Keep only two variables: student ID and “scores of homework and quizzes” from Proc
transpose.

d. Sort the resulting data set in step c such that each student’s 17 to 20 scores of homework and
quizzes are ranked from high to low

e. Transpose data back into the original format, and don’t worry about variable names

code attached

 


Any time you create a data set in SAS you can add options to Keep or Drop variables.

An example you should be able to run:

Proc sort data=sashelp.class
              out= work.class(keep= name sex age)
;
   by sex age;
run;

The options go inside parentheses after the name of the data set. The data set options can be used with just about any data set. There are some interactions between Keep/ Drop and Rename (yes you can change the name of variable just before/after use) in the same option as to which name to keep when renaming.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 882 views
  • 1 like
  • 2 in conversation