Hi all-
I have a column that contains a question text response. When the preceding question is marked "other" you are asked to please explan what "other" is. For all the questions where "other" was not marked a *99 in generated
The column looks like this:
Q15 |
---|
*99 |
*99 |
*explanation sentence text text text text text of various lengths |
*99 |
*99 |
*explanation sentence text text text text text of various lengths |
*99 |
*99 |
*explanation sentence text text text text text of various lengths |
*explanation sentence text text text text text of various lengths |
I'm trying to use proc format to assign a value lable of "Skipped" to *99.
I would like the column to look like this:
Q15 |
---|
Skipped |
Skipped |
*explanation sentence text text text text text of various lengths |
Skipped |
Skipped |
*explanation sentence text text text text text of various lengths |
Skipped |
Skipped |
*explanation sentence text text text text text of various lengths |
*explanation sentence text text text text text of various lengths |
This is the proc format statement I wrote:
proc format;
value $other
'*99'='Skipped';
run;
When I apply the format, I don't get the result that I want. The explanations get cut off.
So, i get this.
Q15 |
---|
Skipped |
Skipped |
*explan |
Skipped |
Skipped |
*explan |
Skipped |
Skipped |
*explan |
*explan |
Is there anyway i can modify the proc format statement so the explanations don't get cut off and I can still assign a value label to *99?
Any help is greatly appreciated. Thanks.
Matthew,
I can't test it tonight, but do you get what you want if you include the default option when specifying the format in proc format (see: http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a002473473.htm ) ?
Matthew,
I can't test it tonight, but do you get what you want if you include the default option when specifying the format in proc format (see: http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a002473473.htm ) ?
Yes, that was what im looking for. Thanks Art.
There is a easy way to avoid this truncation..
you can use this code..
proc format;
value $test (default=50)
"*99"="*skipped";
run;
(In default= option you can specify length for the fomat)
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.