How do I format so that I know what each variable means in the output table?

Reply
Occasional Contributor
Posts: 16

How do I format so that I know what each variable means in the output table?

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

PROC Star
Posts: 7,471

Re: How do I format so that I know what each variable means in the output table?

Posted in reply to BytheLake

You assign labels to the variables.

Occasional Contributor
Posts: 16

Re: How do I format so that I know what each variable means in the output table?

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

PROC Star
Posts: 7,471

Re: How do I format so that I know what each variable means in the output table?

Posted in reply to BytheLake

data class;

  set sashelp.class;

  label age='Monday';

  label height='Tuesday';

  label weight='Wednesday';

run;

proc means data=class;

  var age height weight;

run;

Occasional Contributor
Posts: 16

Re: How do I format so that I know what each variable means in the output table?

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

PROC Star
Posts: 7,471

Re: How do I format so that I know what each variable means in the output table?

Posted in reply to BytheLake

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

Occasional Contributor
Posts: 16

Re: How do I format so that I know what each variable means in the output table?

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

Ask a Question
Discussion stats
  • 6 replies
  • 226 views
  • 6 likes
  • 2 in conversation