$UPCASEw. format

We all know the importance of UPCASE function in handling the character case strings. But do you know that a format can let you do the same as the UPCASE function (upcasing the variables).
$UPCASEw. format works similar to the UPCASE Function. It also does one more thing which UPCASE function doesn’t. i.e: $UPCASEw. format let you apply length to the variable.

Remember that w specifies the width of the output field.

Example:
*********************************************************;
data new;
*convert it to uppercase;
name="studysas blog";
format name $upcase.;
newname=put(name, $upcase32.);
*Put function let you apply $upcase format;
run;
**********************************************;

*The length of the new variable newname will be 32.

Comments

Popular posts from this blog

SAS Interview Questions and Answers: CDISC, SDTM and ADAM etc

Comparing Two Methods for Removing Formats and Informats in SAS: DATA Step vs. PROC DATASETS

Studyday calculation ( --DY Variable in SDTM)