BookmarkSubscribeRSS Feed
Filipvdr
Pyrite | Level 9

I have tried the answer on this topic:

https://communities.sas.com/t5/General-SAS-Programming/Spaces-added-to-between-PIPE-delimiter-when-w...

 

But then i get 4 quotes around my values like """"value""""|"""""column2"""""|"""""""""|

 

proc sql;
create view work.W2MFNVH as
select
(strip(put(VEQUNR3,30.))) as Connection_GlobalID length = 30
format = $30.,
VSTREET as Street,
VHOUSEN1 as HouseNumber1,
VHOUSEN2 as HouseNumber2,
VCITY as Municipality,
(compress(ZGPSCOORY)) as XCoord length = 20
format = $20.
label = 'Aansl e gps coordinaat x',
(compress(ZGPSCOORX)) as YCoord length = 20
format = $20.
label = 'Aansl e gps coordinaat y'
from &SYSLAST
;
quit;

%let SYSLAST = work.W2MFNVH;
options missing='';
data _null_;
set &SYSLAST;
attrib Connection_GlobalID length = $30
format = $30.;
attrib Street length = $60
format = $60.;
attrib HouseNumber1 length = $10
format = $10.;
attrib HouseNumber2 length = $10
format = $10.;
attrib Municipality length = $40
format = $40.;
attrib XCoord length = $20
format = $20.;
attrib YCoord length = $20
format = $20.;
quote='"';
file "&aa_path.reload.coordinatesdn.&ts..del" dlm='|' DSD;

if ( _n_ = 1 ) then
do;
put
"Connection_GlobalID|Street|HouseNumber1|HouseNumber2|Municipality|XCoord|YCoord";
end;
put
quote +(-1) Connection_GlobalID +(-1) quote
quote +(-1) Street +(-1) quote
quote +(-1) HouseNumber1 +(-1) quote
quote +(-1) HouseNumber2 +(-1) quote
quote +(-1) Municipality +(-1) quote
quote +(-1) XCoord +(-1) quote
quote +(-1) YCoord +(-1) quote
;

run;

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Please use a code window, its the {i} above the post area.  Why are you using &SYSLAST throughout and manually setting it at one point, this is not the way to program in SAS.

As for your question:

options missing='';
data _null_; 
  set work.w2mfnvh; 
  file "&aa_path.reload.coordinatesdn.&ts..del" dlm='|' dsd;
  if _n_=1 then put "Connection_GlobalID|Street|HouseNumber1|HouseNumber2|Municipality|XCoord|YCoord";
  put connection_globalid street housenumber1 housenumber2 municipality xcoord ycoord;
run;

What does the above not do?  The output file generated there is fine and compliant delimited text - file extension fine!.  You only need quotes if the data contains the delimiter, which if it does then change the delimiter.

Filipvdr
Pyrite | Level 9
I'm using DI studio, therefor it uses syslast. The above makes sure that i don't have blanks between 2 pipes. But it generates extra quotes (4 double quotes). I have to follow some guidelines like the format has to be .del and string characters needs to have double quotes.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 604 views
  • 0 likes
  • 2 in conversation