BookmarkSubscribeRSS Feed
sas1018
Fluorite | Level 6

hi I am new to sas preparing for certification.Can somebody help me with the below program:

 

Create 3 groups for Cvar:A-G is group=1;H-N is group=2;o-z is group=3.

All variations of the variables should be in the same group i.e "A" or "a" should be in group=1.

Calculate the average of X and Y by group.

 

My question is :Do i need to create new variables X and Y to calculate average?

 

7 REPLIES 7
ballardw
Super User

Existing data.

Show us what you have.

Better would be to use a small example and then the desired result for the given example.

 

Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the <> icon or attached as text to show exactly what you have and that we can test code against.

 

"Groups" of values within a single variable can often be done with custom format applied to the variable in a reporting or summarizing procedure.

Also, do you need a data set for output (for further analysis) or a report (people read these).

 

Details: does your CVAR only have one character or is it longer? Is the group based on a single variable or multiple (which is why we ask you to show an example of your data).

sas1018
Fluorite | Level 6
Hi
 
I have attached my program file below.
 
Thank you.
ballardw
Super User

Don't see any values or even variables X and Y in your program. Anywhere. So where are the values of X and Y supposed to come from. To be a "mean" there needs to be at least one numeric value to make sense of the question.

sas1018
Fluorite | Level 6

Thank you. Got the solution with the X and Y variables.They were already in another dataset. I thought I need to create one.Thanks a lot.

Kurt_Bremser
Super User

You do not need to attach SAS programs as files. Copy/paste the code into a window opened with the "little running man".

Also take a little time to read the articles in the "Welcome" section on how to post questions and how to get fast, helpful answers.

sas1018
Fluorite | Level 6

Sure. From next time I will do that. Thank you.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 7 replies
  • 1715 views
  • 0 likes
  • 3 in conversation