BookmarkSubscribeRSS Feed
Cynthia_sas
SAS Super FREQ
Hi:
In my last program, I had exactly the same situation as you describe now. Specifically, each person had a possibility of 1 or 2 children. In my program, information for ALL children was retained (using the RETAIN statement) until the entire observation could be output. That would be the same situation as you have with your data.
Studying how the trailing @ and the RETAIN statement work together would help you figure out how to read you data.

cynthia
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
It's just data, frankly.

If you have multiple DX1 records/segments, you will need to adapt your SAS program to declare some maximum of "n" combined sets of SAS variables in your output file structure -- using RETAINs but also ideally using ATTRIB/LENGTH stmts to declare the variable attributes (coded before the INPUT and RETAIN stmts). So if you intend to capture and output up to 3 sets of DX1 segments, you must have declared the three combinations of variables, each identified uniquely in your program. Also, your program will need to detect when it is the first, second, third DX1 record and populate the corresponding segment set, such as detecting a blank or missing variable value or by using some temporary SAS variable as a flag indicating how many DX1 segments have been read.

Remember, this is straightforward SAS DATA step programming reading some external data, whether HL7 or otherwise -- the key is that you have shared the input side, but, unfortunately, not the desired output side as an illustration of your SAS dataset/variable structure sample.

Scott Barry
SBBWorks, Inc.
deleted_user
Not applicable
That's fine...I thought I can link up with Cyndy. Sorry about that.

So my question is if I want to write out all of the data from segments e1 thru a1 into one record and to ctach all of the values inside repeated segments like DX1 , how to do that in sas program.
When I am reading dx1 segments, it is ignoring what ever comes first if repeated and outputting only last value from the DX1 segment. I want to wrte out all values from DX1 from each of the repeated to a single record along with other variables.

thanks for you help!!
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Share your code please. It's a guessing game otherwise.

Scott Barry
SBBWorks, Inc.
deleted_user
Not applicable
Given below as my data -

(removed as per user)

I am using below code annd my code is not reading the repeated DX1 segments/PT2 segments. writing out one last segment.


Is this helps ??

thanks,

Message was edited by: Sasbase Message was edited by: Sasbase
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
It's clear that your "output logic" is only executed (once) after a specific set of input segment-types have been read up. From what I can see, the code is not designed to handle multiple segments of the same type. So, that stated, what would you expect to see in the output where you have multiple instances of a particular segment type?

Scott Barry
SBBWorks, Inc.
deleted_user
Not applicable
In Mulitiple sgements like PT2, I want to get a hold of SSN, member ID and Group whereever data is populated. My current code is reading only one of PT2 (last one )

When writing out the claim record, I want to write out the needed info from the repeated segments - like SSN, MemberID from PT2 and From DX1 (they are diagnosis codes ) - may need to write out all of them where ever populated, else the ones came in.

thanks,
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Honestly, you are going to need to support this SAS application going forward, correct? What happens with the next modification request? Obviously my opinion, but I am not confident that the SAS Discussion Forum is really suitable for doing the programming for you - is there someone who can assist with the SAS program modification task at your site?

Scott Barry
SBBWorks, Inc.
deleted_user
Not applicable
Thanks.....

I will see other options. So you are not aware of HL7 code then 🙂

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
  • 23 replies
  • 4904 views
  • 1 like
  • 4 in conversation