I have a data table that has a list of emails
I want to create a text file that has these in a continous list like this
Bob@test.com;Jim@test.com;Steve@test.com;Cindy@test.com;Kelly@test.com;
proc sql noprint ;
select email into :emails separated by ' ; '
from eData
;
quit;
But whenever I put I get errors and I think it has to do with the semi-colon at the end.
Thank you
You are pulling the values into a macro variable. How did you try to get them into a text file?
It is probably much easier to just write them directly into the text file.
data have;
input email $50. ;
cards;
run;
data _null_;
file "email_list.txt" lrecl=20000 dlm=';' ;
if eof then put;
set have end=eof;
put email @@ ;
run;
data _null_;
infile "email_list.txt" lrecl=20000;
input;
list;
run;
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9--
1 Bob@test.com;Jim@test.com;Steve@test.com;Cindy@test.com;Kelly@test.com 70
NOTE: 1 record was read from the infile "email_list.txt".
The minimum record length was 70.
The maximum record length was 70.
You are pulling the values into a macro variable. How did you try to get them into a text file?
It is probably much easier to just write them directly into the text file.
data have;
input email $50. ;
cards;
run;
data _null_;
file "email_list.txt" lrecl=20000 dlm=';' ;
if eof then put;
set have end=eof;
put email @@ ;
run;
data _null_;
infile "email_list.txt" lrecl=20000;
input;
list;
run;
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9--
1 Bob@test.com;Jim@test.com;Steve@test.com;Cindy@test.com;Kelly@test.com 70
NOTE: 1 record was read from the infile "email_list.txt".
The minimum record length was 70.
The maximum record length was 70.
It seems to be impossible to prevent the editor from converting text that LOOK like email addresses into hyperlinks.
:smileycry:
Tom wrote:
It seems to be impossible to prevent the editor from converting text that LOOK like email addresses into hyperlinks.
:smileycry:
This is a test to see if syntax box prevents hyperlink.
data have;
input email $50. ;
cards;
run;
data _null_;
file "email_list.txt" lrecl=20000 dlm=';' ;
if eof then put;
set have end=eof;
put email @@ ;
run;
data _null_;
infile "email_list.txt" lrecl=20000;
input;
list;
run;
What is a syntax box? How did you create it?
I use plain. Why SAS is not an option is beyond my comprehension. :smileyconfused:
Click upper right button HTML.
And add these thing into it.
E-mail of hyperlink will not appear any more
<pre>
proc print ..
</pre>
Ksharp
Thanks. I have played with the HTML, but I am frustrated that it puts in so many redundant <font> and <span> tags. Perhaps if I start with the HTML editor I could prevent that.
Since You want it in a txt file ,why use Macro variable to get it. Data step can solve it easily.
data have; input email $50. ; cards; Bob@test.com Jim@test.com Steve@test.com Cindy@test.com Kelly@test.com ; run; data _null_; file "c:\email_list.txt" lrecl=20000 ; set have end=eof; put email +(-1) ';' @@ ; run;
Ksharp
Thank you to both of you for your suggestions. The data step with the put and the @@ was the way to go.
Thanks again
why was it a problem for the macro language?
It is what macro quoting is about (well one of)
%let list =
;
%let delimited = %qsysfunc( translate( %sysfunc( compbl( &list)), %str(;), %str( ) ));
%put &delimited ;
Here is the log output
164 %put &delimited ;
Bob@test.com;Jim@test.com;Steve@test.com;Cindy@test.com;Kelly@test.com
those mail envelope icons are presented by this forum viewer and are not present on the assgnment of %let, nor output from SAS Message was edited by: Peter Crawford (just after posting original)
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.