If there is ALWAYS a semicolon between the "jobs" then it is the same thing basically. You just need another loop outside of the example that will select the jobs.
But a working example of code would require showing what the resulting DATA SET looks like.
I might be tempted to make one observation per JOB for clarity.
data example;
x="United States Army Officer, Office of Strategy, United States Department of the Army (1980-2009); Highly Qualified Expert, United States Department of the Army (2009-2011); Director, U.S. Army Heritage and Education Center, United States Department of the Army, United States Department of Defense; Assistant Chief, Museum Support Center, U.S. Army Center of Military History, United States Department of Defense; Member, Department of Defense Historical Advisory Committee, Office of the Secretary of Defense, United States Department of Defense (2011-2012); Director and Chief of Military History, U.S. Army Center of Military History, Office of the Administrative Assistant to the Secretary, United States Department of the Army (2011-2014); Chair, The Commission, World War I Centennial Commission; Acting Secretary, American Battle Monuments Commission (2017-2018)";
Array v (15) $ 50;
length jobtext $ 200;
do jobnum=1 to countw(x,';');
jobtext = scan(x,jobnum,';');
do i=1 to countw(jobtext,',');
v[i]=scan(jobtext,i,',');
end;
output;
end;
drop i;
run;
What we cannot do by code because each "job" does not have the the same fields is tell what the ones between "title" and "organization" may be because there are differing numbers of values based on your rules of "separate by comma".
You can try to parse out years from the last "word" in the JOBTEXT (i.e. when i=countw(jobtext,','); IF the data is regular enough it just another application of SCAN with ( - and ) used as the delimiters (no "countw" needed for that). However if there are ever any other uses of ( - or ) character that may not work.
... View more