LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 2009, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 5 Feb 2009 16:41:19 -0800
Reply-To:     "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Subject:      Re: Write a macro variable to a file.
Comments: To: Arthur Tabachneck <art297@NETSCAPE.NET>
In-Reply-To:  <200902060016.n15HxiBh015693@malibu.cc.uga.edu>
Content-Type: text/plain; charset=iso-8859-1

Art,

You are correct. I unthinkingly used

%PUT "&gene_names.";

in open code and of course got the quotes, then tested assigning the macro to a variable in the data step. Maybe I can claim a senior moment, or the end of a long day as my excuse. Nah!, nobody is going to buy that. :-)

Mea culpa,

Dan

Daniel J. Nordlund Washington State Department of Social and Health Services Planning, Performance, and Accountability Research and Data Analysis Division Olympia, WA 98504-5204

> -----Original Message----- > From: Arthur Tabachneck [mailto:art297@NETSCAPE.NET] > Sent: Thursday, February 05, 2009 4:16 PM > To: SAS-L@LISTSERV.UGA.EDU; Nordlund, Dan (DSHS/RDA) > Subject: Re: Write a macro variable to a file. > > Dan, > > I was about to post a response when I saw that Joe had beat me to it. > > The response I had prepared was: > > proc sql noprint; > select name into :gene_names > separated by '^' from > sashelp.class > ; > quit; > > data _null_; > file "c:\sqltest.txt"; > put "&gene_names."; > run; > > There aren't any quotes in the output file. > > Art > ------- > On Thu, 5 Feb 2009 15:59:36 -0800, Nordlund, Dan (DSHS/RDA) > <NordlDJ@DSHS.WA.GOV> wrote: > > >> -----Original Message----- > >> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On > >> Behalf Of Joe Matise > >> Sent: Thursday, February 05, 2009 3:29 PM > >> To: SAS-L@LISTSERV.UGA.EDU > >> Subject: Re: Write a macro variable to a file. > >> > >> I think it needs to be in quotes, doesn't it? You can put a > >> quoted string > >> in a file, but not just plain text [which it will interpret > >> as god knows > >> what, variable names and such]. > >> So, > >> data _null_; > >> file "file"; > >> put > >> "&gene_names" > >> ; > >> run; > >> should work, though how useful it is depends on the > structure of your > >> gene_names variable of course ;) > >> > >> -Joe > >> > >> On Thu, Feb 5, 2009 at 5:19 PM, Mary <mlhoward@avalon.net> wrote: > >> > >> > Hi, > >> > > >> > How do I write out a macro variable to a file? I want to > >> add the gene > >> > names > >> > above my line > >> > of variables in Excel, and thought I would just write > them out as a > >> > delimited string and > >> > pull into Excel. I tried this: > >> > > > > >And if you don't want the quotes output, assign the macro > variable to a > data step variable and PUT that. > > > >data _null_; > > file "file"; > > text = "&gene_names" ; > > put text; > >run; > > > >Hope this is helpful, > > > >Dan > > > >Daniel J. Nordlund > >Washington State Department of Social and Health Services > >Planning, Performance, and Accountability > >Research and Data Analysis Division > >Olympia, WA 98504-5204 > >


Back to: Top of message | Previous page | Main SAS-L page