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?
X and Y should already be present in your input dataset.
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).
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.
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.
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.
Sure. From next time I will do that. Thank you.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.