BookmarkSubscribeRSS Feed
mauri0623
Quartz | Level 8

I have the attached macro and the part of the table for you. Basically the values of 2019 and Preliminary 202 are numeric and I want to change them to "NA". I have written this code and works outside the macro. I am not sure where to place this code inside the macro. Your help is appreciated.

 


/*
data c97(drop=_2019 _2020 rename=(_2019_1 = _2019 _2020_1 = _2020));
set C97;
if ag_code = "084500" then do;
_2019_1 = put(_2019,8.);
_2020_1 = put(_2020,8.);
_2019_1 = _2019;
_2020_1 = _2020;
if _2019_1 = 0 then _2019_1 = "NA";
if _2020_1 = 0 then _2020_1 = "NA";

end;
run;
*/

6 REPLIES 6
PaigeMiller
Diamond | Level 26

Many of us will not download attachments, as they can be a security threat.

 

Please place this line before the macro, and then re-run this line and the macro

options mprint;

Then show us the log for this section of code, all of the log for this section of code, with nothing chopped out, so we can see the code, NOTES, WARNINGs and ERRORs as they appear in the log. Copy the log and then please click on the </> icon and paste the log into the window that appears. Do not show us the log via any other method.

--
Paige Miller
mauri0623
Quartz | Level 8


25304
25305 %agency_by_year_DST_report(&BeginSet1FY, &EndSet1FY, 1, C97, DST097_v69.xls, &titDST097, 2);
MPRINT(AGENCY_BY_YEAR_DST_REPORT): ods listing close;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): ods markup tagset=tagsets.cl2klandscape6 path= "R:\Research\NSF\Federal Funds Surveys\Fed Funds
Surveys\2019\Data Repository\Computer Code\DST\Output" body="DST097_v69.xls" style=excel_calcz alias='landscape';
NOTE: Writing MARKUP Body file: DST097_v69.xls
MPRINT(AGENCY_BY_YEAR_DST_REPORT): ods escapechar='~';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): proc report data=C97 nowd style(report)=[rules=none cellspacing=0 frame=void
htmlstyle="border-top:.5pt; border-bottom:.5pt; border-left:none; border-right:none" foreground=black background=white]
style(column)=[htmlstyle="border-top:none; border-bottom:none; border-left:none; border-right:none" outputheight=11.75pt
foreground=black background=white vjust=b] style(header)=[htmlstyle="border-top:none; border-bottom:.5pt; border-left:none;
border-right:none" foreground=black background=white vjust=b] style(summary) =[htmlstyle="border-top:none; border-bottom:none;
border-left:none; border-right:none" foreground=black background=white outputheight = 6pt] ;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): column linect stubname stubout continue_flag ag_code ag_order_DHT _2011 _2011mil _2012 _2012mil
_2013 _2013mil _2014 _2014mil _2015 _2015mil _2016 _2016mil _2017 _2017mil _2018 _2018mil _2019 _2019mil filler ('Preliminary' _2020
_2020mil );
MPRINT(AGENCY_BY_YEAR_DST_REPORT): define filler / computed ' ' style(header)={vjust=b just=r cellwidth=.15in}
style(column)={protectspecialchars=off};
MPRINT(AGENCY_BY_YEAR_DST_REPORT): compute filler / character length=2;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): filler=' ';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): endcomp;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): define ag_code / display noprint '';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): define linect / order order=data noprint;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): define stubname / display noprint ' ' style(header)={vjust=b just=l cellwidth=3.4in}
style(column)={protectspecialchars=off};
MPRINT(AGENCY_BY_YEAR_DST_REPORT): define stubout / computed 'Agency and subdivision' style(header)={vjust=b just=l
cellwidth=3.4in} style(column)={protectspecialchars=off};
MPRINT(AGENCY_BY_YEAR_DST_REPORT): define continue_flag / display noprint '' ;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): define ag_order_DHT / display noprint '' ;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): define _2011 / display noprint '' style(header)={vjust=b just=r} style(column)={vjust=b just=r
cellwidth=.50in};
MPRINT(AGENCY_BY_YEAR_DST_REPORT): define _2011mil / computed "2011" style(header)={vjust=b just=r} style(column)={vjust=b just=r
cellwidth=.50in htmlstyle="border:none; mso-number-format:\#\,#\#0\.0"};
MPRINT(AGENCY_BY_YEAR_DST_REPORT): define _2012 / display noprint '' style(header)={vjust=b just=r} style(column)={vjust=b just=r
cellwidth=.50in};
MPRINT(AGENCY_BY_YEAR_DST_REPORT): define _2012mil / computed "2012" style(header)={vjust=b just=r} style(column)={vjust=b just=r
cellwidth=.50in htmlstyle="border:none; mso-number-format:\#\,#\#0\.0"};
MPRINT(AGENCY_BY_YEAR_DST_REPORT): define _2013 / display noprint '' style(header)={vjust=b just=r} style(column)={vjust=b just=r
cellwidth=.50in};
MPRINT(AGENCY_BY_YEAR_DST_REPORT): define _2013mil / computed "2013" style(header)={vjust=b just=r} style(column)={vjust=b just=r
cellwidth=.50in htmlstyle="border:none; mso-number-format:\#\,#\#0\.0"};
MPRINT(AGENCY_BY_YEAR_DST_REPORT): define _2014 / display noprint '' style(header)={vjust=b just=r} style(column)={vjust=b just=r
cellwidth=.50in};
MPRINT(AGENCY_BY_YEAR_DST_REPORT): define _2014mil / computed "2014" style(header)={vjust=b just=r} style(column)={vjust=b just=r
cellwidth=.50in htmlstyle="border:none; mso-number-format:\#\,#\#0\.0"};
MPRINT(AGENCY_BY_YEAR_DST_REPORT): define _2015 / display noprint '' style(header)={vjust=b just=r} style(column)={vjust=b just=r
cellwidth=.50in};
MPRINT(AGENCY_BY_YEAR_DST_REPORT): define _2015mil / computed "2015" style(header)={vjust=b just=r} style(column)={vjust=b just=r
cellwidth=.50in htmlstyle="border:none; mso-number-format:\#\,#\#0\.0"};
MPRINT(AGENCY_BY_YEAR_DST_REPORT): define _2016 / display noprint '' style(header)={vjust=b just=r} style(column)={vjust=b just=r
cellwidth=.50in};
MPRINT(AGENCY_BY_YEAR_DST_REPORT): define _2016mil / computed "2016" style(header)={vjust=b just=r} style(column)={vjust=b just=r
cellwidth=.50in htmlstyle="border:none; mso-number-format:\#\,#\#0\.0"};
MPRINT(AGENCY_BY_YEAR_DST_REPORT): define _2017 / display noprint '' style(header)={vjust=b just=r} style(column)={vjust=b just=r
cellwidth=.50in};
MPRINT(AGENCY_BY_YEAR_DST_REPORT): define _2017mil / computed "2017" style(header)={vjust=b just=r} style(column)={vjust=b just=r
cellwidth=.50in htmlstyle="border:none; mso-number-format:\#\,#\#0\.0"};
MPRINT(AGENCY_BY_YEAR_DST_REPORT): define _2018 / display noprint '' style(header)={vjust=b just=r} style(column)={vjust=b just=r
cellwidth=.50in};
MPRINT(AGENCY_BY_YEAR_DST_REPORT): define _2018mil / computed "2018" style(header)={vjust=b just=r} style(column)={vjust=b just=r
cellwidth=.50in htmlstyle="border:none; mso-number-format:\#\,#\#0\.0"};
MPRINT(AGENCY_BY_YEAR_DST_REPORT): define _2019 / display noprint '' style(header)={vjust=b just=r} style(column)={vjust=b just=r
cellwidth=.50in};
MPRINT(AGENCY_BY_YEAR_DST_REPORT): define _2019mil / computed "2019" style(header)={vjust=b just=r} style(column)={vjust=b just=r
cellwidth=.50in htmlstyle="border:none; mso-number-format:\#\,#\#0\.0"};
MPRINT(AGENCY_BY_YEAR_DST_REPORT): define _2020 / display noprint '' style(header)={vjust=b just=r} style(column)={vjust=b just=r
cellwidth=.57in};
MPRINT(AGENCY_BY_YEAR_DST_REPORT): define _2020mil / computed "2020" style(header)={vjust=b just=r} style(column)={vjust=b just=r
cellwidth=.57in htmlstyle="border:none; mso-number-format:\#\,#\#0\.0"};
MPRINT(AGENCY_BY_YEAR_DST_REPORT): compute _2011mil / character length=15;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if continue_flag = 0 or index(stubname, "Departments") > 0 or index(stubname, "Other agencies")
> 0 then _2011mil = ' ';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if _2011 = -99999999 then _2011mil = 'na';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if _2011 = -999 then _2011mil = 'NA';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if 0 < _2011 < 50000 then _2011mil = '*';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if ag_code = "084500" and _2019 = 0 and _2020 = 0 then do;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2019_1 = put(_2019,8.);
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2020_1 = put(_2020,8.);
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2019_1 = _2019;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2020_1 = _2020;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if _2019_1 = '0.0' then _2019_1 = "NA";
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if _2020_1 = '0.0' then _2020_1 = "NA";
MPRINT(AGENCY_BY_YEAR_DST_REPORT): end;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else _2011mil = right(put(_2011/1000000,comma15.1));
MPRINT(AGENCY_BY_YEAR_DST_REPORT): ;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): endcomp;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): compute _2012mil / character length=15;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if continue_flag = 0 or index(stubname, "Departments") > 0 or index(stubname, "Other agencies")
> 0 then _2012mil = ' ';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if _2012 = -99999999 then _2012mil = 'na';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if _2012 = -999 then _2012mil = 'NA';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if 0 < _2012 < 50000 then _2012mil = '*';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if ag_code = "084500" and _2019 = 0 and _2020 = 0 then do;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2019_1 = put(_2019,8.);
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2020_1 = put(_2020,8.);
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2019_1 = _2019;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2020_1 = _2020;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if _2019_1 = '0.0' then _2019_1 = "NA";
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if _2020_1 = '0.0' then _2020_1 = "NA";
MPRINT(AGENCY_BY_YEAR_DST_REPORT): end;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else _2012mil = right(put(_2012/1000000,comma15.1));
MPRINT(AGENCY_BY_YEAR_DST_REPORT): ;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): endcomp;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): compute _2013mil / character length=15;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if continue_flag = 0 or index(stubname, "Departments") > 0 or index(stubname, "Other agencies")
> 0 then _2013mil = ' ';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if _2013 = -99999999 then _2013mil = 'na';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if _2013 = -999 then _2013mil = 'NA';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if 0 < _2013 < 50000 then _2013mil = '*';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if ag_code = "084500" and _2019 = 0 and _2020 = 0 then do;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2019_1 = put(_2019,8.);
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2020_1 = put(_2020,8.);
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2019_1 = _2019;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2020_1 = _2020;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if _2019_1 = '0.0' then _2019_1 = "NA";
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if _2020_1 = '0.0' then _2020_1 = "NA";
MPRINT(AGENCY_BY_YEAR_DST_REPORT): end;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else _2013mil = right(put(_2013/1000000,comma15.1));
MPRINT(AGENCY_BY_YEAR_DST_REPORT): ;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): endcomp;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): compute _2014mil / character length=15;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if continue_flag = 0 or index(stubname, "Departments") > 0 or index(stubname, "Other agencies")
> 0 then _2014mil = ' ';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if _2014 = -99999999 then _2014mil = 'na';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if _2014 = -999 then _2014mil = 'NA';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if 0 < _2014 < 50000 then _2014mil = '*';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if ag_code = "084500" and _2019 = 0 and _2020 = 0 then do;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2019_1 = put(_2019,8.);
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2020_1 = put(_2020,8.);
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2019_1 = _2019;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2020_1 = _2020;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if _2019_1 = '0.0' then _2019_1 = "NA";
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if _2020_1 = '0.0' then _2020_1 = "NA";
MPRINT(AGENCY_BY_YEAR_DST_REPORT): end;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else _2014mil = right(put(_2014/1000000,comma15.1));
MPRINT(AGENCY_BY_YEAR_DST_REPORT): ;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): endcomp;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): compute _2015mil / character length=15;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if continue_flag = 0 or index(stubname, "Departments") > 0 or index(stubname, "Other agencies")
> 0 then _2015mil = ' ';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if _2015 = -99999999 then _2015mil = 'na';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if _2015 = -999 then _2015mil = 'NA';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if 0 < _2015 < 50000 then _2015mil = '*';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if ag_code = "084500" and _2019 = 0 and _2020 = 0 then do;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2019_1 = put(_2019,8.);
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2020_1 = put(_2020,8.);
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2019_1 = _2019;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2020_1 = _2020;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if _2019_1 = '0.0' then _2019_1 = "NA";
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if _2020_1 = '0.0' then _2020_1 = "NA";
MPRINT(AGENCY_BY_YEAR_DST_REPORT): end;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else _2015mil = right(put(_2015/1000000,comma15.1));
MPRINT(AGENCY_BY_YEAR_DST_REPORT): ;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): endcomp;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): compute _2016mil / character length=15;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if continue_flag = 0 or index(stubname, "Departments") > 0 or index(stubname, "Other agencies")
> 0 then _2016mil = ' ';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if _2016 = -99999999 then _2016mil = 'na';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if _2016 = -999 then _2016mil = 'NA';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if 0 < _2016 < 50000 then _2016mil = '*';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if ag_code = "084500" and _2019 = 0 and _2020 = 0 then do;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2019_1 = put(_2019,8.);
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2020_1 = put(_2020,8.);
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2019_1 = _2019;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2020_1 = _2020;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if _2019_1 = '0.0' then _2019_1 = "NA";
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if _2020_1 = '0.0' then _2020_1 = "NA";
MPRINT(AGENCY_BY_YEAR_DST_REPORT): end;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else _2016mil = right(put(_2016/1000000,comma15.1));
MPRINT(AGENCY_BY_YEAR_DST_REPORT): ;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): endcomp;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): compute _2017mil / character length=15;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if continue_flag = 0 or index(stubname, "Departments") > 0 or index(stubname, "Other agencies")
> 0 then _2017mil = ' ';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if _2017 = -99999999 then _2017mil = 'na';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if _2017 = -999 then _2017mil = 'NA';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if 0 < _2017 < 50000 then _2017mil = '*';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if ag_code = "084500" and _2019 = 0 and _2020 = 0 then do;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2019_1 = put(_2019,8.);
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2020_1 = put(_2020,8.);
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2019_1 = _2019;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2020_1 = _2020;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if _2019_1 = '0.0' then _2019_1 = "NA";
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if _2020_1 = '0.0' then _2020_1 = "NA";
MPRINT(AGENCY_BY_YEAR_DST_REPORT): end;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else _2017mil = right(put(_2017/1000000,comma15.1));
MPRINT(AGENCY_BY_YEAR_DST_REPORT): ;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): endcomp;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): compute _2018mil / character length=15;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if continue_flag = 0 or index(stubname, "Departments") > 0 or index(stubname, "Other agencies")
> 0 then _2018mil = ' ';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if _2018 = -99999999 then _2018mil = 'na';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if _2018 = -999 then _2018mil = 'NA';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if 0 < _2018 < 50000 then _2018mil = '*';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if ag_code = "084500" and _2019 = 0 and _2020 = 0 then do;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2019_1 = put(_2019,8.);
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2020_1 = put(_2020,8.);
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2019_1 = _2019;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2020_1 = _2020;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if _2019_1 = '0.0' then _2019_1 = "NA";
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if _2020_1 = '0.0' then _2020_1 = "NA";
MPRINT(AGENCY_BY_YEAR_DST_REPORT): end;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else _2018mil = right(put(_2018/1000000,comma15.1));
MPRINT(AGENCY_BY_YEAR_DST_REPORT): ;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): endcomp;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): compute _2019mil / character length=15;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if continue_flag = 0 or index(stubname, "Departments") > 0 or index(stubname, "Other agencies")
> 0 then _2019mil = ' ';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if _2019 = -99999999 then _2019mil = 'na';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if _2019 = -999 then _2019mil = 'NA';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if 0 < _2019 < 50000 then _2019mil = '*';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if ag_code = "084500" and _2019 = 0 and _2020 = 0 then do;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2019_1 = put(_2019,8.);
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2020_1 = put(_2020,8.);
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2019_1 = _2019;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2020_1 = _2020;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if _2019_1 = '0.0' then _2019_1 = "NA";
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if _2020_1 = '0.0' then _2020_1 = "NA";
MPRINT(AGENCY_BY_YEAR_DST_REPORT): end;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else _2019mil = right(put(_2019/1000000,comma15.1));
MPRINT(AGENCY_BY_YEAR_DST_REPORT): ;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): endcomp;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): compute _2020mil / character length=15;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if continue_flag = 0 or index(stubname, "Departments") > 0 or index(stubname, "Other agencies")
> 0 then _2020mil = ' ';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if _2020 = -99999999 then _2020mil = 'na';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if _2020 = -999 then _2020mil = 'NA';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else if 0 < _2020 < 50000 then _2020mil = '*';
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if ag_code = "084500" and _2019 = 0 and _2020 = 0 then do;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2019_1 = put(_2019,8.);
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2020_1 = put(_2020,8.);
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2019_1 = _2019;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): _2020_1 = _2020;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if _2019_1 = '0.0' then _2019_1 = "NA";
MPRINT(AGENCY_BY_YEAR_DST_REPORT): if _2020_1 = '0.0' then _2020_1 = "NA";
MPRINT(AGENCY_BY_YEAR_DST_REPORT): end;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): else _2020mil = right(put(_2020/1000000,comma15.1));
MPRINT(AGENCY_BY_YEAR_DST_REPORT): ;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): endcomp;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): compute stubout / character length=200;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): stubout=trim(stubname);
MPRINT(AGENCY_BY_YEAR_DST_REPORT): endcomp;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): title "<div>TABLE 97&nbsp;&nbsp;Federal outlays for research, development, and R&D plant, by
agency: FYs 2010&ndash;20&nbsp;<br/>" "~S={font_size=8pt}(Dollars in millions)<br/></div>" ;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): break before linect / skip summarize suppress;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): run;

NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).
8:12 9:12 8:12 9:12 8:12 9:12 8:12 9:12 8:12 9:12 8:12 9:12 8:12 9:12 8:12 9:12 8:12 9:12
8:12 9:12
NOTE: Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line):(Column).
29 at 13:33 29 at 13:33 29 at 13:33 29 at 13:33 29 at 13:33 29 at 13:33 29 at 13:33 29 at 13:33 29 at 13:33
29 at 13:33
NOTE: There were 115 observations read from the data set WORK.C97.
NOTE: PROCEDURE REPORT used (Total process time):
real time 0.40 seconds
cpu time 0.37 seconds


MPRINT(AGENCY_BY_YEAR_DST_REPORT): ods markup close;
MPRINT(AGENCY_BY_YEAR_DST_REPORT): ods listing;

 

mauri0623
Quartz | Level 8

Where I have added my code did not work.

PaigeMiller
Diamond | Level 26

Copy the log and then please click on the </> icon and paste the log into the window that appears. Do not show us the log via any other method.

--
Paige Miller
Kurt_Bremser
Super User

@PaigeMiller wrote:

Many of us will not download attachments, as they can be a security threat.


And the fact that the forum previewer chokes on a text file is not reassuring, either.

Tom
Super User Tom
Super User

Please explain when you want to display NA instead of the numeric value?  The code in your question is confused.

if ag_code = "084500" then do;
  _2019_1 = put(_2019,8.);
  _2020_1 = put(_2020,8.);
  _2019_1 = _2019;
  _2020_1 = _2020;
  if _2019_1 = 0 then _2019_1 = "NA";
  if _2020_1 = 0 then _2020_1 = "NA";
end;

You appear to be creating _2019_1 as a CHARACATER variable, but then later you are comparing if it equals the number zero (not a string with the 0 digit in it). 

Did you want the IF statements to use the original variable instead?

if ag_code = "084500" then do;
  _2019_1 = put(_2019,8.);
  _2020_1 = put(_2020,8.);
  _2019_1 = _2019;
  _2020_1 = _2020;
  if _2019 = 0 then _2019_1 = "NA";
  if _2020 = 0 then _2020_1 = "NA";
end;

Note you could make a custom format to display NA when the value is zero (or any other values).

proc format;
  value na (default=8) 0='NA';
run;

Now there is no need to change the actual dataset. Just change the FORMAT attached the variable so that values of zero will print as NA.

proc print data=c97 ;
  format _2019_1 _2020_1 na.;
run;
How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1900 views
  • 2 likes
  • 4 in conversation