f



Re: Converting Macro Variable to a SAS Dataset Variable #2

Sounds like you should address this at the step where you create the macro
variable; instead of creating a macro variable, create a dataset (or a
dataset variable).  (I assume this is related to your other query, which
indicates that you create this macro variable in PROC SQL).

Can you post some code and sample data for how you arrive at &p1 in the
first place?

-Joe

On Wed, Mar 18, 2009 at 10:22 AM, Siddharth Jain <sjain@aveopharma.com>wrote:

> If I have a macro variable p1 where %put <<p1>>; results in <<p1>>
> 01,02,03,06
>
>
> How do I bring value of p1 to a dataset. Can I make a dataset variable
> which
> has the same values as of p1.
>
>
> Thanks in advance for your help,
> Siddharth
>
0
snoopy369 (1724)
3/18/2009 3:31:17 PM
comp.soft-sys.sas 142828 articles. 3 followers. Post Follow

0 Replies
866 Views

Similar Articles

[PageSpeed] 0

Reply:

Similar Artilces:

Re: Converting Macro Variable to a SAS Dataset Variable
Refer to my previous answer; if you put them in a data set then = transpose the data set, you avoid macro variables altogether. However, to answer = the=20 question: data newtable; informat p1 8.; p1=3D&p1; run; To assign character variables, use the macro variable in double quotes informat char_var $20.; char_var=3D"&macro_var"; -Mary ----- Original Message -----=20 From: Siddharth Jain=20 To: SAS-L@LISTSERV.UGA.EDU=20 Sent: Wednesday, March 18, 2009 10:22 AM Subject: Converting Macro Variable to a SAS Dataset Variable If I have a macro variable p1 where %put <<p1>>; results in <<p1>> = 01,02,03,06 How do I bring value of p1 to a dataset. Can I make a dataset variable = which has the same values as of p1. Thanks in advance for your help, Siddharth ...

Re: Converting Macro Variable to a SAS Dataset Variable #3
Send mail to the list not a person on the list! data visit1; set la11; if visitnum=1; lastresc1=lastresc; keep subjid lastresc1; run; data visit222; set la11; if visitnum=222; lastresc222=lastresc keep subjid lastresc222; run; data visit777; set la11; if visitnum=777; lastresc777=lastresc; keep subjid lastresc777; run; data new; merge visit1 visit222 visit777; by subjid; run; Proc Transpose could also be used on your first data set to flip it. -Mary ----- Original Message ----- From: Siddharth Jain To: Mary Sent: Wednesday, March 18, 2009 10:59 AM Subject: RE: Converting Macro Variable to a SAS Dataset Variable Hello Mary, Thanks for your response. Below is the code I have up till now: Per subjid per visit per organ code, I have to see whether result is changing or not. Thanks, Siddharth data la11; set la; if lacat in ('NTL') and subjid in ('101-001'); keep subjid visitnum lasitcd lastresc; run; proc sql; select distinct LASTRESC into :p1 separated by ',' from la11 where visitnum eq 1; select distinct LASTRESC into :p2 separated by ',' from la11 where visitnum eq 222; select distinct LASTRESC into :p3 separated by ',' from la11 where visitnum eq 777; %put <<p1>> &p1 <<p2>> &p2 <<p3> &p3; From: Mary [mailto:mlhoward@avalon.net] Sent: Wednesday, March 18, 2009 11:54 AM To: Siddharth Jain; SAS-L@LISTSERV.UGA.EDU Subject: Re: Converting Macro Variable t...

Re: Converting Macro Variable to a SAS Dataset Variable #4
Siddharth, If I understand properly, you are looking to identify, for each subject / organ code (where here is organ code, by the way - is that lasticd?), whether there is a difference between one visit and the next? For that I imagine you're best off using one of the various stat procs, I'm not an expert in that area but there are plenty of ways of analyzing change over (variable) of (variable). You could also normalize your data (if it's not already, that's not clear) by visit date and create three visit date tables, one for each date of interest, and then merge them together, then creating a fourth variable as the difference between the three. -Joe On Wed, Mar 18, 2009 at 10:41 AM, Siddharth Jain <sjain@aveopharma.com>wrot= e: > Hello Joe, > > > > Thanks for your response. Below is the code I have up till now: > > > > Per subjid per visit per organ code, I have to see whether result is > changing or not. > > > > Thanks, > > Siddharth > > > > > > > > *data* la11; > > set la; > > if lacat in ('NTL=92) and subjid in ('101-001'); > > keep subjid visitnum lasitcd lastresc; > > *run*; > > > > *proc* *sql*; > > select distinct LASTRESC into :p1 separated by ',' from la11 wherevisi= tnum eq > 1; > > select distinct LASTRESC into :p2 separated by ',' from la11 wherevisi= tnum eq > 222;...

Converting Macro Variable to a SAS Dataset Variable
If I have a macro variable p1 where %put <<p1>>; results in <<p1>> 01,02,03,06 How do I bring value of p1 to a dataset. Can I make a dataset variable which has the same values as of p1. Thanks in advance for your help, Siddharth ...

Re: urgent : Convert SAS array in to sas variables #2
On Sat, 3 May 2008 23:34:44 -0700, Shailesh <shailesh.tewari@GMAIL.COM> wrote: >In my dataset I have an array variable , say A which has values like >Observation 1 - A[1]= 23 ,A[2]=34, A[3]=45 >Observation 2 - A[11]= 23 ,A[12]=34, A[13]=45 > >I want to create sas variables which should have name A61, A62 , A63, >A64 .......... >Similarly for second observation these would be A71, A72, >A73 , A74......... > > >in the same datastep. > >Any help ? > >Regards, >Shailesh Arrays are DATA *step* structures. They do not exists in data *...

Re: SAS Macro to delete a SAS dataset #2 313487
I too like(d) PROC DELETE. When I used it I was forced to remove it and use PROC DATASETS because PROC DELETE is not documented. Also, but I have not tested it. How does it work with indexed data sets, audit trails, generation data groups, views, etc.? I don't worry much about deleting, "all" of my programs run in batch and are obsolete as soon as they are written. On 12/3/09, Fehd, Ronald J. (CDC/CCHIS/NCPHI) <rjf2@cdc.gov> wrote: > > From: SAS Techies > > Subject: SAS Macro to delete a SAS dataset > > > > Here's a simple SAS...

Re: SAS Intrnet question, passing macro variables to SAS.
Jia, You have to mask tokens that appear in pairs. In your example precede the single quote (') with a % sign. Try: &libdata=test&citystate=%str(%'Birmingham, AL%',%'Dothan, AL%',%'Huntsville,AL%') Nikhil Sardesai -----Original Message----- From: Michael L. Davis [mailto:michael@BASSETTCONSULTING.COM] Sent: Friday, January 28, 2005 5:13 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: [SAS-L] SAS Intrnet question, passing macro variables to SAS. Hello Jia and other SAS-L Friends, I'm not sure I know the answer but I have some ideas. However, first, I have a question. Are you building the URL outside of an HTML form? If you are, the following link on the SAS web site might interest you: http://support.sas.com/faq/039/FAQ03925.html You might also want to look at the following link: http://support.sas.com/rnd/web/intrnet/dispatch82/input.html Look at the section titled "Specifying Name/Value Pairs in a URL". Most likely, the ampersands might be playing a role. SAS/IntrNet strips off "unsafe characters" unless you tell it not to do so. Please see: http://support.sas.com/rnd/web/intrnet/dispatch82/srvusaf.html Part of that link states: The APPSRV_UNSAFE function returns the complete, original value of an input name/value pair. Normally unsafe characters (see the UNSAFE option) are stripped from input values before creating the input macro variables. This is done so that macro variables may be freely used in a a...

Re: SAS Global Macro Variables #2
To make it individual, also a macro could be used, e.g. for different environments: %create_vars(PROD); %create_vars(TEST); in that case you must use %global var1 var2 var3; for all the variables, otherwise they are local to the macro. We use something like that in a AUTOEXEC file and the macro automaticly detects were it is running and creates the right variables. The macro has the advantage over a %INCL, that you can use logic there. In %INC that is also possible: simply write the macro call into that, or use a DATA _NULL_ step to assign the variables. Gerhard On Thu, 5 Jun 2008 11...

Re: Ordering Variables in SAS Dataset #2
The SET and RETAIN statements are in the wrong order. On Thu, Mar 20, 2008 at 8:02 AM, DaDoctor <brett.a.summers@bankofamerica.com> wrote: > Fellow Members: > > I am working ordering a SAS dataset and thought I could use the retain > statement for this purpose. > > However, the process is bombing. > > syntax: > > data temp_dset; > set out.perm_dset; > retain var1 var2.........; > > run; > > > suggestions on what I am doing wrong? > ...

Re: Storing SAS-programs and -macros in SAS-datasets on a HOST-platform #2
How about catalogs? They are already used for macros. I believe other code could be used via %INCLUDE. On Tue, 5 Oct 2004 09:57:46 -0700, Jesper Sahner <jespersahner@HOTMAIL.COM> wrote: >Hi! > >Ususally SAS-programs and -macros on a HOST-platform are stored in >PDS-datasets, which are not SAS-datasets. However I am interested in >storing programs in a regular SAS-dataset in the same way tables and >formats are stored. Is that possible? (this should be easy in SCL - >which I am not familiar with - but how do you do it in Base-SAS? > >I believe that storing pro...

Re: Convert text variable to SAS date #2
Drat Harry. I wanted to answer that one. :-) ...

Re: comparing pdf files and SAS Datasets for variables... #2
If I was in your shoes, I would try to convert the PDF to Excel so I could more easily manipulate and clean up the data. There are a number of products out there but a free one you can try (not tested myself) can be found at: http://www.brothersoft.com/office-convert-pdf-to-excel-for-xls-free-204767.h tml TinyURL: http://tinyurl.com/cutu96 Phil Philip Rack MineQuest, LLC SAS & WPS Consulting and WPS Reseller Tel: (614) 457-3714 Web: www.MineQuest.com Blog: www.MineQuest.com/WordPress -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Al Sent: 02/11/2009 5:52 PM To: SAS-L@LISTSERV.UGA.EDU Subject: comparing pdf files and SAS Datasets for variables... Hi , I don't know if this possible or not but here it is ..Is there a way to compare a case report forms (in pdf format ) and SAS datasets to know if all the variables listed in the crfs are present in the SAS datasets through a SAS Program.. I have around 40 CRF's for each of the 4 protocols.. its tedious doing manually .. Please direct me in the right direction.. Thanks in advance . ...

Re: How to read a period in a variable from a file to SAS dataset #2
On Mon, 28 Jul 2008 02:01:10 -0700, =?ISO-8859-1?Q?Rune_Runnest=F8?= <rune@FASTLANE.NO> wrote: >/* >This is the file with the fileref MYFILE: > >--------------------------------------- >DOKTITTEL: this is the first record >--------------------------------------- >DOKTITTEL: . >--------------------------------------- >DOKTITTEL: this is the third record >--------------------------------------- >*/ > >/* >I want the second record to be '.', not ' '. >How can I obtain that? > >Rune >*/ >filename myfile "d:\tem...

Re: PASSING macro variable from sas program to JCL #2
SASGUY, Remembering back to my mainframe days, I think you need an intermediate static file to hold the file name (xxx.yyy.bbbb.0412). This file would be created by the step that creates the variable-name file. In your succeeding step or job, have a DD statement pointing to the static file and the SAS program reads the filename out of that. Something like this: //step1 exec sas //sysin dd dsn=create.dynamic.output.file //static dd dsn=holds.name.of.variable.file //* //step2 exec sas //sysin dd dsn=READ.dynamic.output.file //static dd dsn=holds.name.of.variable.file Notice that the dynamic d...

Re: Assign variables to a new variable based on variable names in SAS #3
Here's a solution that builds a list of subscripts in macro variables named like the 'a_' columns in the input dataset. 'a_' fields are referenced by the subscript from the array they're defined to be part of: data stuff; a_2003q4 = 44; a_2003q1 = 11; a_2003q2 = 22; a_2003q3 = 33; n = 'a_2003q3'; run; proc sql noprint; create table columns as select name from sashelp.vcolumn where libname = 'WORK' and memname = 'STUFF' and name eqt 'a_' order by name ; select compbl('...

Re: Assign variables to a new variable based on variable names in SAS #4
On Thu, 15 Jan 2004 11:02:05 -0800, W M <mwx74@HOTMAIL.COM> wrote: >I have met the following problem and I need your expert help. >The variable names in the data set looks like this: > >a_1995q3 a_1995q4 a_1997q1 ........... a_2003q4 n > Is there a way like > >new_a=a_{value of n} ? > >Because of the compilation of data step, you cannot do > >data new; set old; >call symput("name", n); >new_a=a_&n; (wrong !) >run; Hi, V, Following up on Paul (Choate)'s idea, this seems to work. This would serve as an example of putting an...

Re: Assign variables to a new variable based on variable names in SAS #5
Hi Chang & V - I'm confused as usual - did you mean this? 142 data one; 143 a_1995q3 = 1; 144 a_1995q4 = 2; 145 a_1997q1 = 3; 146 a_2003q4 = 5; 147 n = "2003q4"; 148 run; NOTE: The data set WORK.ONE has 1 observations and 5 variables. NOTE: DATA statement used: real time 0.01 seconds cpu time 0.01 seconds 149 150 data two; 151 set one; 152 call symput('n', n); 153 new_a = 'a_'||resolve(n); 154 put new_a=; 155 run; new_a=a_2003q4 NOTE: There were 1 observations read from the data set WORK.ONE...

Re: Assign variables to a new variable based on variable names in SAS #7
Chang, I agree with your assessment of Richard's code. I especially liked that he offered it without any chest pounding! Joe -----Original Message----- From: "Chang Y. Chung" <chang_y_chung@HOTMAIL.COM> Sent: Jan 16, 2004 11:19 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Assign variables to a new variable based on variable names in SAS Hi, Richard, Your data step, "monkeyshines" is one of the prettest I have ever seen. Really nice. The to-the-point array statement using the variable name wild character (":"); use of lbound() hbound() f...

Re: Assign variables to a new variable based on variable names in SAS #6
Hi, Richard, Your data step, "monkeyshines" is one of the prettest I have ever seen. Really nice. The to-the-point array statement using the variable name wild character (":"); use of lbound() hbound() functions; use of _i_ for index variable; short but intuitive variable and array names like aVars, aBase, and aMap; use of intnx and intck functions, reading the returned variable name with ??yyq6. format, anticipation of range checking, and all the work was done in essentially a single line!("a_new = aVars[aMap[qtrIndex]];") ... I learn a lot just by reading your...

Re: MVS Merge Variable Data Using SAS Merge or SAS SQL JOIN #2
A: You may want to consider using nested queries to create the keys that you need to join the tables? That gives the SQL compiler a way to bound the search space. For example, proc sql; create table temp as select * from (select <key transformation>,* from small) as t1 left join (select <key transformation>,* from large) as t2 on t1.<transformed key> EQT t2.<transformed key> ; Now the SQL compiler has two keys from the same domain that it can index or use as sort keys. This method works with composite keys as well. Just make sure that the <transformed key> v...

Re: Can SAS startup option set a macro variable ? #2
Summary: INITSTMT #iw-value=1 Richard, Have you looked at the INITSTMT option? I used to use it a lot before the autoexec was introduced. With an autocall library, you could invoke a macro that could handle any number of things. The initstmt runs after the autoexec and before any other code. Sorting out how many quote marks to use is a pain because various systems remove quote marks. But done correctly it should work fine with scripts for batch jobs. Ian Whitlock ================ Date: Thu, 22 Nov 2007 22:22:27 -0500 Reply-To: "Richard A. DeVenezia" <rdevenezi...

Re: Macro Variable w. Another Macro Variable in name #2
Hi Arthur and all, It's getting closer thankfully. The code below works. However, when I try to make this macro variable (that has another macro in its handle) a non-constant function, I get another error. So the code was: %let count&s0=%sysevalf(&&count&s0+1); The error generated was: WARNING: Apparent symbolic reference COUNT not resolved Greatly appreciate your help. On 1/18/07, Arthur Tabachneck <art297@netscape.net> wrote: > > Are you trying to accomplish something like: > > %macro testidea; > %let myarray=XX XY YY; > %do i=1 %to 3...

[Fwd: Re: SAS 9: How to send macro variable to autosignon remote] #2
thank you John ---------------------------- Original Message ---------------------------- Subject: Re: SAS 9: How to send macro variable to autosignon remote From: "John" <bentleyj@mindspring.com> Date: Fri, November 10, 2006 3:59 To: peter.crawford@BLUEYONDER.CO.UK -------------------------------------------------------------------------- Peter, in the SUGI 27 Proceedings I have a paper titled 'Passing Macro Values to a Remote Multi-Process SAS/CONNECT Session'. You might find it useful. John Bentley Charloote, NC, USA Send Lawyers, Guns, and Money -...

urgent : Convert SAS array in to sas variables
In my dataset I have an array variable , say A which has values like Observation 1 - A[1]= 23 ,A[2]=34, A[3]=45 Observation 2 - A[11]= 23 ,A[12]=34, A[13]=45 I want to create sas variables which should have name A61, A62 , A63, A64 .......... Similarly for second observation these would be A71, A72, A73 , A74......... in the same datastep. Any help ? Regards, Shailesh On May 4, 2:34=A0am, Shailesh <shailesh.tew...@gmail.com> wrote: > In my dataset I have an array variable , say A which has values like > Observation 1 - A[1]=3D 23 ,A[2]=3D34, A[3]=3D45 > Observati...

Web resources about - Re: Converting Macro Variable to a SAS Dataset Variable #2 - comp.soft-sys.sas

PastBook’s Filepicker.io Integration Eases Process Of Converting Facebook Content To Books
PastBook , one of several companies that allow Facebook users to publish their content on the social network in actual books , announced the ...

Facebook No Longer Converting Groups Into Pages
Back when Facebook first launched Facebook Pages, many businesses and brands who had built up substantial audiences in their Facebook Groups ...

Zwartz Laminating-Converting B.V. on the App Store on iTunes
Get Zwartz Laminating-Converting B.V. on the App Store. See screenshots and ratings, and read customer reviews.


"Occupier" Thanked Former Soviet Citizen for "Converting" Him to Capitalism, Pro-Israel, Pro-USA - YouTube ...
May Day Demonstration on Union Square in New York City Zionism & Birth of Modern Israel in 1948: Former Soviet Citizen Pays Tribute to Ben-Gurion ...

Converting dry air to water: solution to Broken Hill's water crisis gains support
A one-man crusade by a Broken Hill resident to solve the historic town's water crisis by introducing air to water converters is gaining support. ...

Click go fears of converting print files
Is there a way to convert a print queue item to a .RTF or .PDF file? I like to save or email them. - The Sydney Morning Herald

Sudanese woman ordered to hang under sharia law for converting to Christianity gives birth
Khartoum, Sudan: A Christian Sudanese woman sentenced to hang for apostasy has given birth in jail, a Western diplomat said on Tuesday.

Imams warn against radicalism to Aboriginal inmates converting to Islam
The prison system has enlisted the help of ASIO to crack down on radicalisation behind bars amid revelations that Aboriginals are converting ...

Converting the world's companies one by one - The Science Show - ABC Radio National (Australian Broadcasting ...
Image: Trucks carrying logs make their way up a road in Jambi, Indonesia. A vast area of the Sumatran forest, and orangutan habitat, is being ...

Resources last updated: 3/16/2016 9:46:52 AM