05-21-2014 04:09 AM
Im having a small issue creating an XML output.
Each variable in my put statement, generates and blank after it (which it shouldnt!).
Heres a small sample code:
set step2 end=eof;
if _n_=1 then do;
put '<set label="'visityearweek'" value="'count'"/>'; <----- PROBLEM!
if (eof=1) then do;
<set label="2014-04 " value="2839 "/> <--- BLANKS after var..!
<set label="2014-05 " value="3232 "/>
<set label="2014-06 " value="2433 "/>
Anyone got an idea why this occurs? (i have tried to compress/strip the variables first without luck, theres no blanks in data).
05-21-2014 08:26 AM
The put statement by default adds a delimiting space at the end of each variable printed so list output does not run everything together.
In this context the + is a pointer control, so +9 would move the pointer (the next printing position) 9 spaces further.
There is no '-' pointer control so if you need to move back one space you need to advance the pointer control by (-1).
An alternative would be to place your text and values explicitly using the @ pointer, but you might have to calculate the length of the count variable each time.
Need further help from the community? Please ask a new question.