Below is an example of what i am trying to achieve.
INFILE DATALINES DSD;
INPUT A $CHAR50.;
MM Regional Calls
San Gabriel Valley
INFILE DATALINES DSD DLM="|" TRUNCOVER;
INPUT A :$CHAR30. B :$CHAR3. C :$CHAR30.;
WM AZ|MM|WM AZ
San Diego|MM|San Diego
San Gabriel Valley|MM|San Gabriel Valley
APPOINTMENTS|MM|San Gabriel Valley
Contacts|MM|San Gabriel Valley
Orange County+Ontario|MM|Orange County+Ontario
Long Beach|MM|Long Beach
San Diego|SBB|San Diego
Los Angeles|SBB|Los Angeles
Long Beach|SBB|Long Beach
Pretty crude and specific but here is a solution. Won't work for any broader examples.
data want2(keep=a b c);
count + 1;
b = 'MM';
if a = 'MM Regional Calls' then count = 0;
if count = 4 then count = 1;
if count = 1 then c = a;
Probably because the "rule" for why SBB takes the place of MM in the data is not in any way obvious. Do you have other codes in that role as well? You would have to test each record to see if it is the appropriate code and assign to the retained variable.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.