A while back a responder generously provided to me a detailed example on writing a proc format statement. I'm now trying to use that example and do something useful. Here's what i have.
proc format;
value couse2 0='0 neither' 1='1 either' 2 '2 both';
value dalc1r_ 0= '0 no' 1='1 yes';
value dmj1r_ 0 = '0 no' 1 = '1 yes';
run;
proc freq data=co_usevars;
table couse2;
table dalc1r*dmj1r;
run;
Here's what i want. Instead of the standard listing, I want to see the frequency listings show this;
0 neither 200 25.00 200 25.00
1 either 400 50.00 600 75.00
2 both 200 25.00 800 100.00
I want the crosstab to show, what i would call the value labels, e.g., 1 yes, in the table.
Nothing works.
The format for couse2 gives an error because a variable can not end in a number, dalc1r_ doesn't give an error in the format command but neither that construction nor dalc1r yields the value labels in either the frequency listing nor the crosstab.You may be wondering why i wrote dalc1r 0='0 no' instead of dalc1r 0='no'. That's because a much more experienced use warned me that the 'no' wipes out the 0. I've got Ron Cody's very nice book and, interesting ly, in the proc format chapter he does not show an example that uses proc freq. I been told that proc report or proc tabulate gives more options. I accept that it's true--and i'm sure that additional work is involved. What is useful enough to us is a fully labeled frequency listing or crosstab table, sometimes with a chisquare and sometimes without a chisquare.
The question is can sas be made to give me what i want?
Thanks, Gene Maguin