Hi All
For a case like in the example below:
Is there an efficient and elegant way to tell the input statement that I only want to read the field after the second delimiter?
Is there a way how I can avoid having to map and then drop columns a and b?
data _null_;
infile datalines dsd dlm='|' truncover;
input a $ b $ c $;
put c=;
drop a b;
datalines;
aaaa|bbb|ccc||ee
u|ww||yy|z
1|222|3333333|4|5
;
Hi, if you just need C, you could parse directly from the input buffer, like this.
data _null_;
infile datalines dsd /* dlm='|' */ truncover;
input /* a $ b $ c $ */;
C=scan(_infile_,3,'|');
put c=;
/* drop a b; */
datalines;
aaaa|bbb|ccc||ee
u|ww||yy|z
1|222|3333333|4|5
;
be sure to prealocate a large enough length for the C var.