BookmarkSubscribeRSS Feed
BytheLake
Calcite | Level 5

Hi,

I am figuring out the mean for the variables ABD, NHD, NHJ and NHD, and I get their means in my output table. However, I want to format so that the table in the output has a separate column that indicates what ABD, NHD, NHJ and NHD stand for. I want to indicate so that ABD is for Monday, NHD is Tuesday, NHJ is for Wednesday and NHD is for Thursday. Each of ABD, NHD, NHJ and NHD is not categorized, and I do not plan to categorize (there is no need for that since all I need is the mean). How do I define (or format ) so that monday, tuesday and Wednesday and Thursday appear in a separate column on the output table?

proc means data=____.____.;

var ABD NHD NHJ NHD;

run;

Thanks,

GF

6 REPLIES 6
art297
Opal | Level 21

You assign labels to the variables.

BytheLake
Calcite | Level 5

I understand that's what I need to do, but how do I code? I think I am using PROC FORMAT for this, but I have only used PROC FORMAT for variables with categories. What should be my code for assigning labels to a variable that is not categorized?

Thanks,

GF

art297
Opal | Level 21

data class;

  set sashelp.class;

  label age='Monday';

  label height='Tuesday';

  label weight='Wednesday';

run;

proc means data=class;

  var age height weight;

run;

BytheLake
Calcite | Level 5

Dear Mr. Tabachneck,

Wow, that was amazing. I never used the LABEL statement, so I am learning a new thing here 🙂 As you can tell, I am very new with SAS, and I wish I knew these little things well enough so that I can just do it without having to ponder and ask around. Do you have any recommendations on how I can get better with SAS?

Thank you.

GF

art297
Opal | Level 21

Do what you are doing, and read as much as you can from the various free sources like http://www.sascommunity.org/wiki/Main_Page, here, SAS-L (Archives of SAS-L@LISTSERV.UGA.EDU</title><style type="text/css"><!--BODY { font-family: "Comic Sans..., and the various papers that have been presented at the regional meetings, SUGI meetings, and Global Forum meetings (which you can find at: http://lexjansen.com/

And, reading as much as you can of the free documentation is also essential (see: SAS Product Documentation)

Also, but not for free but quite useful, take a look at the various books by users that can be found at: Welcome to the SAS Bookstore

BytheLake
Calcite | Level 5

Thanks! I copied and pasted all your recommendation in my special electronic folder! You're so awesome!

sas-innovate-2024.png

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.

 

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.

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
  • 6 replies
  • 628 views
  • 6 likes
  • 2 in conversation