02-18-2016 01:45 AM
I am using SAS 9.4. I have a variable yes/no response options but all of answers were yes. I am using ods tables in proc freq to export the output to a data set and them export it (with DDE) to excel. My excel table is set up with both Yes and No so I should have Yes = 100% and No=0% in excel. Except SAS in the proc freq ods command only exports the 100%. Is there a way for me to export the output in a new data set that contains both Yes and No?
02-18-2016 02:42 AM
PROC FREQ will only report (and output) values that are actually present in the dataset. If you need to have other values in your output dataset, you could create a default dataset containing all values and then do a join to complete your output dataset
data ynresponse; input response $3.; cards; no yes ; run; data wanted_result; merge result (in=a) ynresponse (in=b) ; by response; if not b then count = 0; * avoids missing values; run;
02-18-2016 04:36 AM
data have; input response $3.; cards; yes yes yes yes ; run; data temp; response='no'; run; data want; set have(in=ina) temp; weight=ina; run; proc freq data=want; table response ; weight weight/zeros; run;