BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
texasmfp
Lapis Lazuli | Level 10

I am importing data from a website.  It uses a semicolon as a delimiter for three fields.  Unfortunately, for some reason, a fourth, trailing delimiter exists (I can't change the webpage).  Can I tell SAS to ignore the last ";"  Currently, it creates a fourth field called VAR4.  Its not fatal, but its cloying.  Thanks

 

A header and first line of data: 

 DATE;CANADAI;CANADAR;
  03JAN1992; 0.871612; 0.871612;

 

filename infile temp;
proc http
 url="https://...website.../&insheet..txt"
 method="GET"
 out=infile;
run;

/* Tell SAS to allow "nonstandard" names */
options validvarname=any;

proc import datafile=infile
out=root.&insheet
dbms=dlm
replace;
delimiter=';';
getnames=yes;
run;
1 ACCEPTED SOLUTION

Accepted Solutions
3 REPLIES 3
Kurt_Bremser
Super User

With just three columns, there is absolutely no need for IMPORT. You already have the data step code in the log, take it from there and remove VAR4.

ChrisNZ
Tourmaline | Level 20

As @Kurt_Bremser said, proc import is best avoided.

If you really want to keep proc import you can drop the variable 

out=ROOT.&insheet(drop=VAR4)

 

texasmfp
Lapis Lazuli | Level 10

Thank you Kurt and Chris.  Unfortunately, I have to keep the Proc Import because &insheet sometimes resolves to a long characters string.  So, I just drop it at that 2nd step.

SAS Innovate 2025: Register Today!

 

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 908 views
  • 0 likes
  • 3 in conversation