Is there a way to combine/group similar rows and place them under a new sub-category?
Ignore the bold/underline formatting, they're just to help you understand the column heading and subcategory headings.
Let's say the dataset looks like the following with column Food:
Food Column 2 Column 3 etc (continues till Column 50+)
Apple
Banana
Burger
Crepe
Strawberry
Fries
Pear
Ice Cream
(rows continue for 1000+)
And I want the output to look like:
Food Column 2 Column 3 etc (continues till Column 50+)
Fruits (like a drop down menu)
Apple
Banana
Strawberry
Pear
(etc.)
Unhealthy
Burger
Fries
(etc.)
Dessert
Ice Cream
Crepe
(etc.)
Don't really have a clue how to code this or where to begin. Maybe a Proc Report or Proc Sql?
Help is greatly appreciated!
You can generate a report that looks like what you want. But you first have to add a column to the data. A new variable would take on values like "Fruits", "Unhealthy", or "Dessert".
How would I go about creating a report? Don't seem to see anywhere on the application
What application are you referring to?
If you are programming this, it might (depending on what the report should contain) go like this:
proc sort data=have;
by new_variable_with_food_category;
run;
proc print data=have;
by new_variable_with_food_category;
id new_variable_with_food_category;
var food column2 column3 ... column50;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.