Hi,
I am converting two numeric variables to character and then I am concatenating them. After concatenating the the result variable shows zero instead the vale expected. Could you please help me on this.
data med_23;
length llimit ulimit plci $100;
set plot21;
if ^missing(lowerlimit) then llimit=compress(strip(put(lowerlimit,6.2)));
else llimit="NE";
if ^missing(upperlimit) then ulimit=compress(strip(put(upperlimit,6.2)));
else ulimit="NE";
if ^missing(llimit) and ^missing(ulimit) then plci = strip(put(estimate,6.3))||" ("||llimit||", "|ulimit||")";
run;
if ^missing(llimit) and ^missing(ulimit) then plci = strip(put(estimate,6.3))||" ("||llimit||", "|ulimit||")";
should be
if ^missing(llimit) and ^missing(ulimit) then plci = strip(put(estimate,6.3))||" ("||llimit||", " || ulimit||")";
I added a vertical bar. The added white space was just to make it easier for you to see. You should really look into the cat series of functions, ifc, ifn, etc. They make life easier. You should use one of the cat* functions instead of what you are doing, because you are not stripping values of your intermediate variables before concatenating.
We need to see (a portion) of your data as SAS data step code, pasted into your message after clicking on the "running man" icon. (If your data is in the attachment, many of us will not or can not download attachments as they are a security risk).
It seems to me that LLIMIT and ULIMIT ought to be numeric variables rather than character variables, which would make your programming simpler and perhaps would eliminate the problem you are having.
if ^missing(llimit) and ^missing(ulimit) then plci = strip(put(estimate,6.3))||" ("||llimit||", "|ulimit||")";
should be
if ^missing(llimit) and ^missing(ulimit) then plci = strip(put(estimate,6.3))||" ("||llimit||", " || ulimit||")";
I added a vertical bar. The added white space was just to make it easier for you to see. You should really look into the cat series of functions, ifc, ifn, etc. They make life easier. You should use one of the cat* functions instead of what you are doing, because you are not stripping values of your intermediate variables before concatenating.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: