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)
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.
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.