Hello,
Please i intend to use the output from the proc freq procedure to execute the Proc Transpose , however the Out=AA dataset displays only the Country by Trt01p; So when i use the AA dataset to execute the Proc Transpose , the variables Sex , Race and Country are all missing .
Question : How do i make Sex, Race and Country appear in the AA dataset?
Proc freq data=B ;
Table SEX RACE ETHNIC COUNTRY / out=AA ;
BY Trt01p ;
Run;
/*Step 3*/
Proc Transpose data=AA ;
ID Trt01P ;
BY SEX RACE ETHNIC COUNTRY ;
VAR Count;
run;
I have attached the dataset
Thanks a lot
Try my example here:
https://gist.github.com/statgeek/e0903d269d4a71316a4e
If this is for display, you can also consider PROC TABULATE as an option.
@Anoruo wrote:
Hello,
Please i intend to use the output from the proc freq procedure to execute the Proc Transpose , however the Out=AA dataset displays only the Country by Trt01p; So when i use the AA dataset to execute the Proc Transpose , the variables Sex , Race and Country are all missing .
Question : How do i make Sex, Race and Country appear in the AA dataset?
Proc freq data=B ;
Table SEX RACE ETHNIC COUNTRY / out=AA ;
BY Trt01p ;
Run;
/*Step 3*/Proc Transpose data=AA ;
ID Trt01P ;
BY SEX RACE ETHNIC COUNTRY ;
VAR Count;
run;
I have attached the dataset
Thanks a lot
@Reeza Thanks for your response . It is not actually for display , i want to use it for some computations and i am required to use Proc Transpose. Thanks for your quick response.
Maybe all you need is:
Proc freq data=B ;
Table SEX*RACE*ETHNIC*COUNTRY / out=AA ;
BY Trt01p ;
Run;
proc sort data=aa; by SEX RACE ETHNIC COUNTRY; run;
/*Step 3*/
Proc Transpose data=AA out=bb;
ID Trt01P ;
BY SEX RACE ETHNIC COUNTRY ;
VAR Count;
run;
?
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 how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.