- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have created an automated report, and I was asked to put in the verbiage (increased/decreased/did not change) on a certain line in the report. I was thinking of doing an if/then statement, but I am still trying to figure out how to identify negative and positive values.
The line of code for the report is below. The "increased/decreased/did not change" is dependent on "&DIF_confirmedcount" variable. If the DIF_confirmed out has a negative value, I want it to say "decreased", positive value="increased", and 0="did not change".
PUT "• The number of currently hospitalized patients (placeholder) by &DIF_confirmedcount. (&DIF_bullet3. change) to &bullet3. from the previous reporting day.";
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
%if %eval(&dif_confrimendcount<0) %then %let placeholder=decreased;
%else %if %eval(&dif_confrimendcount>0) %then %let placeholder=increased;
%else %let placeholder=did not change;
PUT "• The number of currently hospitalized patients &placeholder by %sysfunc(abs(&DIF_confirmedcount.)) (&DIF_bullet3. change) to &bullet3. from the previous reporting day.";
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
%if %eval(&dif_confrimendcount<0) %then %let placeholder=decreased;
%else %if %eval(&dif_confrimendcount>0) %then %let placeholder=increased;
%else %let placeholder=did not change;
PUT "• The number of currently hospitalized patients &placeholder by %sysfunc(abs(&DIF_confirmedcount.)) (&DIF_bullet3. change) to &bullet3. from the previous reporting day.";
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Even simpler, use different wording
PUT "• The number of currently hospitalized patients has changed by &DIF_confirmedcount. (&DIF_bullet3. change) to &bullet3. from the previous reporting day.";
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks,
I originally tried this wording, but was asked to add in increase/decrease/did not change.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
A great example of micro-managing, which unfortunately I have run into as well. Very frustrating.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@scolitti1 wrote:
Hi,
I have created an automated report, and I was asked to put in the verbiage (increased/decreased/did not change) on a certain line in the report. I was thinking of doing an if/then statement, but I am still trying to figure out how to identify negative and positive values.
The line of code for the report is below. The "increased/decreased/did not change" is dependent on "&DIF_confirmedcount" variable. If the DIF_confirmed out has a negative value, I want it to say "decreased", positive value="increased", and 0="did not change".
PUT "• The number of currently hospitalized patients (placeholder) by &DIF_confirmedcount. (&DIF_bullet3. change) to &bullet3. from the previous reporting day.";
Personally think that you have left a great many details. I am assuming that since you are using PUT that perhaps you are using a data step to write this. In which case it may be possible to use a FORMAT assigned to the variable (assuming one is actually used)
This is trivial example.
proc format ; value change low-<0='decreased' 0 ='no change' 0<-high= 'increased' ; data _null_; input x; put "The count of something " x change. " by " x "some following boiler plate"; datalines; -34 0 15 0.00001 -999999999 ;
Which creates output
The count of something decreased by -34 some following boiler plate The count of something no change by 0 some following boiler plate The count of something increased by 15 some following boiler plate The count of something increased by 0.00001 some following boiler plate The count of something decreased by -999999999 some following boiler plate
If this is not applicable then show some details.
Note that if the variable name is held in a macro variable you can replace the X that I used with the macro variable.