I would like to create new field called Threshold based on the existing Test field. Is it possible to combine 2 code below with out an additional data step?
if test ="NP" then Threshold="> 14.80 = POS"
else if test="RB" then Threshold="> 14.64 = POS"
else if test="SP" then Threshold="> 19.66 = POS"
proc sql;
create table sample_final as
select sample, test, conc_calculated format=7.2, count(N) as Total_counts,
"" as Threshold,
from sample_calcs
group by sample, test, conc_calculated, Total_counts ;
quit;
Thank you
You can use a SQL CASE expression: https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/sqlproc/n0a85s0ijz65irn1h3jtariooea5.htm
Alternatively create a SAS format and use this format in your SQL to create the new variable. ...or don't even create the variable and just apply the format permanently to variable test.
You can use a SQL CASE expression: https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/sqlproc/n0a85s0ijz65irn1h3jtariooea5.htm
Alternatively create a SAS format and use this format in your SQL to create the new variable. ...or don't even create the variable and just apply the format permanently to variable test.
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.