I have an informational index with the initial 3 sections. How would I get the fourth sections in view of the pointers? For instance, for the file, when the pointer =1, the esteem is 21, so I put 21 is the last esteems in all lines for file 1. Could anyone suggest the procedure to Base SAS.
data test;
input Index Indicator value FinalValue;
datalines;
1 0 5 21
1 1 21 21
2 1 0 0
3 0 4 0
3 1 7 7
3 0 8 7
3 0 2 7
4 1 1 1
4 0 4 1
;
run;
Assuming data is sorted and you want the last given FinalValue then:
data want;
set have;
by Index;
if last.index;
run;
Thanks for the reply. Will try and let you know the details.
Not sure, if i understand what you need to do.
Right? If yes: why is FinalValue=0 in line 4? It should be 7.
3 0 4 0
Is there exactly one observation with having Indicator = 1 for each Index? If yes, try:
data have;
input Index Indicator value;
datalines;
1 0 5
1 1 21
2 1 0
3 0 4
3 1 7
3 0 8
3 0 2
4 1 1
4 0 4
;
run;
data want;
merge have have(rename=(Indicator=Flag value=FinalValue) where=(Flag = 1));
by Index;
drop Flag;
run;
@isabeljason wrote:
I have an informational index with the initial 3 sections. How would I get the fourth sections in view of the pointers? For instance, for the file, when the pointer =1, the esteem is 21, so I put 21 is the last esteems in all lines for file 1. Could anyone suggest the procedure to Base SAS.
data test; input Index Indicator value FinalValue; datalines; 1 0 5 21 1 1 21 21 2 1 0 0 3 0 4 0 3 1 7 7 3 0 8 7 3 0 2 7 4 1 1 1 4 0 4 1 ; run;
Your variables are Index Indicator value FinalValue but you address your values as esteem, "section" and possibly "pointers". It will help everyone to address things in terms of the variable names, or change the variable names to reflect the words you use. Also "initial 3 sections" isn't clear unless you mean "first three values for the variable Index".
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: