data supptrir (keep= qval qnam idvarval trseq);
set sdtm.supptrir;
where qnam='REVPER' and qval='Review 1';
trseq=input(idvarval,best.);
run;
above code should work (tested on another dataset), but for the current dataset it does not work. I got:
Idvarval length is 50. I tried both strip(idvarval) and compress(idvarval) in the input statement, also 8., ??best. etc but never worked. However, when I do it in two steps, it works:
data supptrir (keep=usubjid qval qnam idvarval);
set sdtm.supptrir;
where qnam='REVPER' and qval='Review 1';
run;
data supptrir;
set supptrir ;
trseq=input(idvarval,best.);
run;
what could be the reason? very strange.
Here's a possibility.
Perhaps TRSEQ is already part of SDTM.SUPPTRIR, and has a format connected with it such as 3.1. In that case, the format isn't wide enough to display the results you are getting. But the extra DATA step drops the existing TRSEQ (and its accompanying interfering format).
Enter in your 1st step the line:
put IDVARVAL $hex8. ;
And check - are the trailing characters after the ID number are realy spaces ('20'x in ascii ) ?
You can also do:
textID = translate(IDVARVAL, '#',' ');
put textID=
Do you see in log lines like: 10##### or still 10
Use the hex value in compress function.
Since PICTURES do not convey actual data VALUES show us your actual data. https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.
Here's a possibility.
Perhaps TRSEQ is already part of SDTM.SUPPTRIR, and has a format connected with it such as 3.1. In that case, the format isn't wide enough to display the results you are getting. But the extra DATA step drops the existing TRSEQ (and its accompanying interfering format).
Yes, this is the reason. There was already a TRSEQ variable, although it is all blank values. I should have checked that. Thanks for your hints.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.