07-18-2016 10:10 AM
PROC SQL; SELECT programtypeid, COUNT(childid) AS NewEnroll_ByCou_YTD FROM counts where '01jan2016'd <= dateeval <= &tdate group by programtypeid; QUIT;
Gives me this output:
|Bronx Park and Fordham||3|
|High Bridge and Morrisania||4|
|Hunts Point and Mott Haven||2|
|Chelsea and Clinton||1|
The Neighborhoods variable has 35 more categories and I would like them all listed, even if they are all zeros. Is there a way to do this?
07-26-2016 11:32 PM
The 35 neighborhoods are not in the SAS table or they would have appeared.
Unless you mean that are there but with other dates?
In which case something like this may do:
PROC SQL; SELECT programtypeid, sum( '01jan2016'd <= dateeval <= &tdate ) AS NewEnroll_ByCou_YTD FROM counts group by programtypeid; QUIT;
07-27-2016 03:04 AM - edited 07-27-2016 03:06 AM
Maybe the categories that they don't satify the condition they aren't listed.
I'm going to write another possibility.
PROC MEANS DATA=COUNTS NMISS N;
OUTPUT OUT=SALIDA(N=NewEnroll_ByCou_YTD); RUN;
PROC SORT DATA=SALIDA;
You should include your condition with WHERE;
07-27-2016 03:30 AM
Do you have a format to transform programtypeid to Neighborhoods?
Untested, assuming that a format exists and is named $Neighborhoods:
proc summary data=counts(where=('01jan2016'd <= dateeval <= &tdate)) completetypes nway; class programtypeid / preloadfmt order=data; format programmtypeid $Neighborhoods.; output out=work.CountComplete(drop=_type_ rename=(_freq_=NewEnroll_ByCou_YTD)); run; proc print data=work.CountComplete noobs; run;