@Pandu2 wrote:
And also in EDUTC just need date only not the entire value. Thanks.
If you want to do that type of modification do it after you have gotten the text out the JSON and into actual variables.
@Pandu2 wrote:
I can't be thankful enough for your assistance. I believe you missed out the TY column in the output.
The output is based on the input. Since there were no TY tags in the input there was no values output for. If you require an empty variable just create that along the way.
data temp; infile 'c:\temp\a.json' dsd recfm=n dlm='{[]}, '; input have : $200. @@; if not missing(have); run; data want; merge temp temp(firstobs=2 rename=(have=_have)); if prxmatch('/\b(EDUTC|TY|Dep|PN|ID|UN)\b/i',have); run;
It is easy once you pull them out . Don't you think so ? You can get it on your own.
data temp;
infile 'c:\temp\have.json' dsd recfm=n dlm='{[]}, ';
input have : $200. @@;
if not missing(have);
run;
data want;
merge temp temp(firstobs=2 rename=(have=_have));
if prxmatch('/\b(EDUTC|TY|Dep|PN|ID|UN)\b/i',have);
run;
data want2;
set want;
vname=scan(have,1,'_','kad');
if find(have,'EDUTC','i') then value=scan(_have,1,'T');
else value=_have;
run;
proc transpose data=want2 out=want3;
id vname;
var value;
run;
This might work, but it needs logic to find when new group levels and retain them (the DEP for example).
It also has no counter for the repetitions of the lower levels (UN etc).
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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: