I am trying to group data of one variable RoomType have 4 types of views , and have to group them in my result . But am not getting required result. Please guide.
Data formate3;
set format;
length Group $8;
by RoomType;
Group= Basic $20 for Basic room with view or no view;
Group = Suite $30 for Suites and Luxury suites;
Group = Luxury $30 for Luxury rooms ;
run;
proc print data=format3;
run;
There are several things wrong with your code.
Please provide working data step code which creates sample data for table "format" and then show us how the desired output should look like.
Ok. That isn't valid SAS code and you haven't provided enough information for us to provide suggestions.
Heres a quick primer on how to recode variables in SAS. Just note that if your working with strings you need to enclose them in quotation marks - see your previous question.
http://www.ats.ucla.edu/stat/sas/modules/vars.htm
UCLA tutorials
http://www.ats.ucla.edu/stat/sas/modules/default.htm
And most important - How to ask a good question. Please make an attempt to follow these guidelines.
http://stackoverflow.com/help/how-to-ask
@azee007 wrote:
Dear Reeze , I have already read all the material . But nothing is particular related to my problem. I have written code as below . But facing issues.
We're not psychic. What does 'facing issues' mean?
1. Are there errors in your log?
2. Are results not what you expect? In not, how are they different? Show what you have, what you get, and what you want.
3. From your last question recall string comparisons are case sensitive.
4. Note that you're referencing FORMAT dataset. In your last questions you had progressed to. FORMAT2. If you want your code to build upon each other make sure to reference correct dataset. Also, since FORMAT has a specific meaning in SAS I would recommend avoiding that word as a dataset name to avoid any confusion.
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.
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.