I am trying to do a print a table but the superscript will not work for one of the variables
option missing='0' nodate nonumber orientation=landscape ;
ods escapechar="~";
data ALL;
set ALL;
length outcome $61.
if variablenames eq 'stall' then outcome='The Number of Reported Cases (%)';
if variablenames eq 'caseassign_per' then outcome='The Number of Cases Assigned for an Investigation (%)';
if variablenames eq 'passigned_per' then outcome='Partners assigned (%)';
if variablenames eq 'test_30_per' then outcome='Testing Among OPs (%)';
if variablenames eq 'NONMISSING_REFERAL_active' then outcome='The Number of Cases Active Referral (%)';
if variablenames eq 'NONMISSING_REFERAL_passive' then outcome='The Number of Cases Passive Referral (%)';
if variablenames eq 'part_HIV_test_per' then outcome='The Number of Partners Tested for HIV (%)';
if variablenames eq 'NONMISSING_Active_REFPart' then outcome= 'The Number of Partners Active Referral (%)';
if variablenames eq 'NONMISSING_passive_REFPart' then outcome='The Number of Partners Passive Referral (%)';
***;
if variablenames eq 'stdall' then count=1;
if variablenames eq 'caseassign_per' then count=2;
if variablenames eq 'passigned_per' then count=3;
if variablenames eq 'test_30_per' then count=4;
if variablenames eq 'NONMISSING_REFERAL_active' then count=5;
if variablenames eq 'NONMISSING_REFERAL_passive' then count=6;
if variablenames eq 'part_test_per' then count=7;
if variablenames eq 'NONMISSING_Active_REFPart' then count=8;
if variablenames eq 'NONMISSING_passive_REFPart' then count=9;
if outcome='The Number of Cases Assigned for an Investigation (%)' then outcome=catx(' ',outcome,'~{super 2}');
if outcome='Testing Among OPs (%)' then outcome=catx(' ',outcome,'~{super 3}');
if outcome='The Number of Cases Active Referral (%)' then outcome=catx(' ',outcome,'~{super 4}');
if outcome='The Number of Cases Passive Referral %)' then outcome=catx(' ',outcome,'~{super 4}');
if outcome='Partners assigned (%)' then outcome=catx(' ',outcome,'~{super 5}');
if outcome='Partners assigned (%)' then outcome=catx(' ',outcome,'~{super 5}');
if outcome='The Number of Partners Tested(%)' then outcome=catx(' ',outcome,'~{super 3}');
if outcome='The Number of Partners Passive Referral (%)' then outcome=catx(' ',outcome,'~{super 4}');
if outcome='The Number of Partners Active Referral (%)' then outcome=catx(' ',outcome,'~{super 4}');
run;
PROC SORT DATA=ALL2;
BY descending pop diagnosis COUNT;
RUN;
proc print data= ALL2 noobs; run;
Instead of this
I get this
Well, that sure looks like it should work. Maybe it's a SAS bug. I'm not sure.
You could try changing this
if outcome='The Number of Partners Passive Referral (%)' then outcome=catx(' ',outcome,'~{super 4}');
to the below just to see if we can find a work-around
if outcome='The Number of Partners Passive Referral (%)' then outcome=cat(outcome,' ','~{super 4}',' ');
I'm just changing from CATX to CAT and padding a space on the end. It's basically just a shot in the dark.
Jim
Well, that sure looks like it should work. Maybe it's a SAS bug. I'm not sure.
You could try changing this
if outcome='The Number of Partners Passive Referral (%)' then outcome=catx(' ',outcome,'~{super 4}');
to the below just to see if we can find a work-around
if outcome='The Number of Partners Passive Referral (%)' then outcome=cat(outcome,' ','~{super 4}',' ');
I'm just changing from CATX to CAT and padding a space on the end. It's basically just a shot in the dark.
Jim
You are not defining your variable long enough for the strings you trying to store in it.
332 data test;
333 length outcome $100;
334 outcome='The Number of Cases Assigned for an Investigation (%)' ;
335 outcome=catx(' ',outcome,'~{super 2}');
336 len=length(outcome);
337 put (_all_) (=/);
338
339
340 run;
outcome=The Number of Cases Assigned for an Investigation (%) ~{super 2}
len=64
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.