is there any possibility of reading x value 9 and y value missing here.
with missover option: compatability issues
with truncover option ; inifinite loop
with shorter records in input, we are able use missover and getting the results. I need the same kind of option in this case.
program
data pairs;
infile datalines truncover;
input X Y @@ ;
datalines;
1 2 5 7 9
;
run;
;
Double trailing @@ and MISSOVER are incomparable INFILE statement options.
If you want this to work as I think you do you can add a . for the missing value or use EOF option to resolve the LOSTCARD.
Thanks a lot . very very helpful answer.
Hi John @
Can you please explain why this is failing and the fix when the data has many records. I understand EOF will fail the first time and flow over default behaviour takes effect.
/* Not properly executing*/
data pairs;
infile datalines eof=eof;
input X Y @@ ;
eof: output;
datalines;
1 2 5 7 9
2 3 4 5 6
;;;;
run;
By the way, I have begin to read and understand(try) each and every post of yours in communities here, but i am unable to do an easy seach to all your posts on SAS -L. I'd appreciate if you could share.
Many Thanks,
Charlotte
It depends on what is "correct". What do you expect the result should be. The program pairs 9 from line 1 and 2 from line 2. and "incorrectly" outputs missing for both X and Y when everything is Paried.
Perhaps this is more correct.
On SAS-L I've used two different gmail ids datanull and iebupdte.
Hi, Thank you again. This expected result is to take the missing value without having to jump to the next line and read 2 pairing with 9 to complete a full pair in each observation. Desired results:
1 2
5 7
9 .
2 3
4 5
6 .
and so on please.
the latest program results of yours is:
1 2
5 7
9 2 /* to be corrected
3 4
5 6
Hi Charlotte,
Long time no see . What is up to you now ?
@@ can't do that . You need a special technique : truncover + do while() .
data pairs; infile datalines truncover; input X Y @; do while (X ne . or Y ne .) ; output; input X Y @; end; datalines; 1 2 5 7 9 2 3 4 5 6 ;;;; run;
Xia Keshan
Hi Xia, Thank you so much for the courtesy and that's very kind of you. I took some time off as it has begun to get sunny and warmer, so went for a nice sunny holiday in Southern Europe. Well, got burnt though I only got back to work this week. Thanks as always and ever for all your help. I will never ever forget each one and will always value them, I promise!. I have just started learning SAS seriously and of course I would reach out to you here or offline directly every-time I run into some emergency needing your help when it matters at work.
Thanks for the solution Xia. I remember you telling me you were starting to get busy. Well, in that case I will only bother you for help during the weekends or late evenings at your convenience .
I hope you are doing well and all's well in Beijing.
Peace,
Charlotte
Thanks Charlotte. I admired you have holiday . I have nothing but busy things to do .
Best
Xia Keshan
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.