10-27-2014 03:14 PM
I have a dataset with 5 variables A, B, C, D and E. A is the primary key , B and C are numeric variables, D and E are character variables.
I would like to transpose with A as the by variable in such a way that only non-missing numeric and character variable should be transposed for B,C,D,E.
I am using below code and I am getting period (.) for missing numeric variable in the transposed column.
PROC TRANSPOSE DATA=X OUT=Y
VAR B C D E;
10-27-2014 03:56 PM
I am posting an example.... my output should look like z dataset instead of y...only non missing should be transposed.....
data x ;
IF _N_ LT 5;
IF AGE=14 THEN DO;
PROC TRANSPOSE DATA=X OUT=Y;
VAR AGE SEX HEIGHT WEIGHT;
IF MISSING(COL1) OR COL1=' .' THEN DELETE;
10-27-2014 03:27 PM
When both character(D,E) and numeric (B,C) variables are transposed the numeric variables are converted to character using the format associated with the variable. Since standard missing is usually displayed as . you get . in the new character value. Probably . with leading spaces.
If you want the missing numeric variables to have blank values after transposing use
OPTIONS MISSING=' ';
and then add this.
Message was edited by: data _null_