![]() The last statement of the transpose procedure we will discuss is the BY statement. Example 3: The PROC TRANSPOSE Statements (BY) Lastly, you can use more than one variable in the ID statement. It is also possible to combine the ID statement with the PREFIX option. If it is a numeric variable, then an underscore “_” is added at the beginning of the variable name automatically. The column you use in the ID statement can be a numeric or character variable. If the variable used in the ID statement contains special characters or blanks, SAS replaces them with an underscore (Women_s_Dress). Use the ID statement of PROC TRANSPOSE to use column values as new column names.Īs you can see in the image above, we used the ID statement to give the columns the names of the product (Boot, Sandal, etc.). Finally, with the OUT option, we specify the name of the output data set as “SHOES_JOBURG_TRNS”. We use the PREFIX option to name the new columns “PRODUCT1”, “PRODUCT2”, etc. With the code below we change the _NAME_ column to “VAR_NAME” and the _LABEL_ column to “VAR_LABEL”. If you don’t use the OUT option, SAS will create an output data set with a default name.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |