Help using Base SAS procedures

crating output dataset using proc tabulate

Reply
N/A
Posts: 0

crating output dataset using proc tabulate

data ZIPcode;
set sashelp.ZIPcode;
if msa=0 then msa=.;
label ZIP_class=" " MSA=" " CountyNm=" " AreaCode=" ";
run;


* One PROC step can handle all variables ;
proc format;
value missfmt
.="Num Missing"
other="Num Non-Missing";

value $missfmt
" "="Char Missing"
other="Char Non-Missing";

run;


proc tabulate data=ZIPCode Missing format=comma8. out=sample;
class CountyNm AreaCode MSA ZIP_Class / preloadfmt;
tables CountyNm AreaCode MSA ZIP_Class / printmiss misstext="0";
format _numeric_ missfmt. _character_ $missfmt.;
keylabel n="Count";
title1 "Missing and Non-Missing Counts for each Variable";
run;


Hi,

any one can help me


here i am using proc tabulate for finding missing and non missing count, but soma problem with the output data set. because of i have crated user defined formats.


Thanks and Regards
Saiaram.
Trusted Advisor
Posts: 2,116

Re: crating output dataset using proc tabulate

Posted in reply to deleted_user
The problem is in your format statement; you are applying the missing/non-missing to everything (including the variable "n"). Change it to

format areacode msa missfmt. countynm zip_class $missfmt.;

and the sample dataset contents look right.

Doc Muhlbaier
Duke
Ask a Question
Discussion stats
  • 1 reply
  • 115 views
  • 0 likes
  • 2 in conversation