BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
fengyuwuzu
Pyrite | Level 9
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:

Capture.PNG

 

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. 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

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).

View solution in original post

4 REPLIES 4
Shmuel
Garnet | Level 18

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.

ballardw
Super User

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.

Astounding
PROC Star

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).

fengyuwuzu
Pyrite | Level 9

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. 

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 892 views
  • 0 likes
  • 4 in conversation