Hi, I=92ve a dataset where each row includes a unique provider id and 10 $ variables equal to the sum of charges for a specific procedure code (CPT code). The 10 procedure codes variables are named with the following convention: P_5digitsCPT So, I might have p_90806 and p_40890 and so on. The program id data driven so I could end up each time with 10 different codes. Since all of these start with p_ I can easily define and array using the p_: convention. Now, I want to define 10 new variables representing percentages for each p_ variable (i.e. percent_90806=3Dp_90806/SUM(of ...

Hi All, I got an error saying a variable does not exist in the dataset when creatin= g user defined format based on that dataset, but the variable does exist in= the dataset. I tried to rename the variable, created a new variable based = on that variable, change the format of that variable. But I still keep gett= ing that error message. I am wondering if anyone can help me take a look an= d figure out what might be the problem.=20 The following are the code, error message and formats of each variable.=20 Thanks, Jen data Veh_Type_TX_fmt; set SPECIALTY_CLASS_CODES(rename =3D ('Class Code'n =3D Start Veh_Typ =3D = Label)); where Veh_Typ =3D 'MC' and State in ('CW','TX'); Retain fmtname "$Veh_Type_TX_fmt"; run; 1061 /* Vehicle Type for Motorcycle TX */ 1062 data Veh_Type_TX_fmt; 1063 set SPECIALTY_CLASS_CODES(rename =3D ('Class Code'n =3D Start Veh_Ty= p =3D Label)); 1064 where Veh_Typ =3D 'MC' and State in ('CW','TX'); ERROR: Variable Veh_Typ is not on file WORK.SPECIALTY_CLASS_CODES. 1065 Retain fmtname "$Veh_Type_TX_fmt"; 1066 run; CC's 2 9 6 $CHAR 9 0 $CHAR 9 0 0 43 Class Code 2 5 2 $CHAR 5 0 $CHAR 5 0 0 20 Hazard Excl 2 8 10 $CHAR 8 0 $CHAR 8 0 0 87 MA Operator Exp 2 13 9 $CHAR 13 0 $CHAR 13 0 0 74 Operator Age xMA 2 6 8 $CHAR 6 0 $CHAR 6 0 0 68 Primary Class ID 2 2 11 $CHAR 2 0 $CHAR 2 0 0 95 Rating Prog 2 5 4 $CHAR 5 0 $...

Thank so much Nagakumar Sridhar and Fehd, Ronald J. for answering my previous question. However I was not clear in the original post. I modified my phrasing and the new version is below: 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 Please note that "quarter" numbers in "a_****q*" variables may not be continuous, i.e. there might be a missing quarter. and n can have the value of any quarter for while a_quarter exists, say "1995q3", "...

For example: value of name: John value of Birthday: 090225 (format as yymmdd6.) New value for the new variable: John090225; for the new variable, the birthday keeps yymmdd format(two digits year, two digits month, two digits day). Thank you! ...

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...

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...

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...

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...

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('...

Hello, Assuming all numbers will sum to 100 won't work on its own, since there could be 50 2's and 50 0's. Checking min and max wouldn't work, either, since it wouldn't consider missing values. Combine them, though, and I think it should work: if min(of lag1-lag100) = 1 and max(of lag1-lag100) = 1 and sum(of lag1-lag100) = 100 then newvar = 1; else newvar = 0; ..*^*.*^*.*^*.*^*.*^*. Julia Ramsey Arizona Mail Order Co., Inc. (520) 745-4500, x4149 Julia.Ramsey@cxtown.com -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Akshaya Sent: Monday, October 27, 2008 3:24 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Calculating a New Variable based on existing variables in a Datafile Hi all, I have a datafile with 100 variables, lag1-lag100. I have to calculate a new variable and assign a value of 1, if the value of all 100 variables is 1; else 0. Is there a simpler way, instead of using "IF lag1=1 and lag2=1 and lag3=1 and.... lag100=1". Thanks for any suggestions. Thanks! Akshaya ...

Hi all, I have a datafile with 100 variables, lag1-lag100. I have to calculate a new variable and assign a value of 1, if the value of all 100 variables is 1; else 0. Is there a simpler way, instead of using "IF lag1=1 and lag2=1 and lag3=1 and.... lag100=1". Thanks for any suggestions. Thanks! Akshaya Assume that lagI is numeric, can check if sum(of lag1-lag100) eq 100, if true then 1, else 0. "Akshaya" <akshaya.nathilvar@gmail.com> wrote in message news:55fcb08b-8c93-4d08-93ea-f700f21ea9ad@j68g2000hsf.googlegroups.com... > Hi all, > > I have a datafile with 100 variables, lag1-lag100. I have to calculate > a new variable and assign a value of 1, if the value of all 100 > variables is 1; else 0. Is there a simpler way, instead of using "IF > lag1=1 and lag2=1 and lag3=1 and.... lag100=1". Thanks for any > suggestions. > > Thanks! > Akshaya Akshaya, While Julia's suggested code will probably work, the following doesn't allow for any un-thought-of exceptions: data want; array values(100) lag1-lag100; set have; total=0; do i=1 to 100; total+(values(i) eq 1); end; if total eq 100 then output; run; Art -------- On Mon, 27 Oct 2008 15:23:42 -0700, Akshaya <akshaya.nathilvar@GMAIL.COM> wrote: >Hi all, > >I have a datafile with 100 variables, lag1-lag100. I have to calculate >a new variable and assign a value of 1, if the value of all 100 >variables is 1; else 0...

I have procedure that define.. procedure myFunction (a: in out INTEGER) is begin end which gets called in main like this.... myFunction(5) this gives me error that actual must be variable myFunction(SomeOtherVariable) compiles fine Can anyone please explain whats the difference. Should in out be allowed to read and write to parameters. On 09/28/2014 05:48 PM, Stribor40 wrote: > > procedure myFunction (a: in out INTEGER) is Do you also have a function Myprocedure? > myFunction(5) this gives me error that actual must be variable > m...

Use a array for that: ..... array x(*) lag1-lag100; new_var=1; do i=1 to dim(x) while (new_var=1); if x(i) ne 1 then new_var=0; end; .... something like that should do it. Gerhard n Tue, 28 Oct 2008 05:14:15 -0700, Akshaya <akshaya.nathilvar@GMAIL.COM> wrote: >Hi all, > >I have a SAS datafile with 100 variables, lag1-lag100. I have to >calculate a new variable and assign a value of 1, if the value of all >100 variables is 1; else 0. Is there a simpler way, instead of using >"IF lag1=1 and lag2=1 and lag3=1 and.... lag100=1". Thanks for any >suggestions. > >Thanks! >Akshaya ...

Hi all, I have a SAS datafile with 100 variables, lag1-lag100. I have to calculate a new variable and assign a value of 1, if the value of all 100 variables is 1; else 0. Is there a simpler way, instead of using "IF lag1=1 and lag2=1 and lag3=1 and.... lag100=1". Thanks for any suggestions. Thanks! Akshaya Are all the variables 0/1 variables? Then something like sign(sum(of lag1-lag100)) should work, otherwise the array solution is the shorter option. On Tue, Oct 28, 2008 at 5:44 PM, Akshaya <akshaya.nathilvar@gmail.com> wrote: > Hi all, > > I have a SAS datafile with 100 variables, lag1-lag100. I have to > calculate a new variable and assign a value of 1, if the value of all > 100 variables is 1; else 0. Is there a simpler way, instead of using > "IF lag1=1 and lag2=1 and lag3=1 and.... lag100=1". Thanks for any > suggestions. > > Thanks! > Akshaya > Akshaya, If LAG1-LAG100 are numeric variables with a value of 1 or 0, you could use the MIN function. newvar = min(of lag1-lag100); Jack Jack Clark Senior Research Analyst phone: 410-455-6256 fax: 410-455-6850 jclark@hilltop.umbc.edu University of Maryland, Baltimore County Sondheim Hall, 3rd Floor 1000 Hilltop Circle Baltimore, MD 21250 Confidentiality Notice: This e-mail may contain information that is legally privileged and that is intended only for the use of the addressee(s) named above. If you are not the intended recipient, you are hereby notif...

Hello all, I have a question about creating a new variable name depending on system time. For example, if it is year 2006, I want to automatically call the variable z2006. If it is year 2005, I want to automatically call the variable as z2005. So I wrote a simple program like this %let cyear = %sysfunc(year(%sysfunc(today()))); data new; z&cyear = 6; run; While the above program runs without problem, the SAS editor display 'z' in red, so I figured it is not exactly right. Does anyone have experience in this kind of situation? What is the right way to do this? Thank you! Othe...

Hi Akshaya, An ARRAY solution: ARRAY LagVar Lag1 -- Lag100; * if consecutive in the PDV, or Lag1 - Lag100; NewVar = 1; * initialize; DO I = 1 TO DIM(LagVar); * 100 here; IF LagVar[i] NE 1 THEN DO; NewVar = 0; LEAVE; END; DROP I; RUN; Regards - Jim. -- Jim Groeneveld, Netherlands Statistician, SAS consultant home.hccnet.nl/jim.groeneveld On Tue, 28 Oct 2008 05:14:15 -0700, Akshaya <akshaya.nathilvar@GMAIL.COM> wrote: >Hi all, > >I have a SAS datafile with 100 variables, lag1-lag100. I have to >calculate a new variable and assign a value of 1, if the value of all >100 variables is 1; else 0. Is there a simpler way, instead of using >"IF lag1=1 and lag2=1 and lag3=1 and.... lag100=1". Thanks for any >suggestions. > >Thanks! >Akshaya ...

Indeed, or even more flexible (also untested): data new; set old; flag = 1; array lags(*) lag:; do i = 1 to length(lags); if lags (i) ne 1 then flag = 0; end; run; I think you could even use do over here, but I forget how to get that to behave (it won't work with ... directly? ... or indirectly ... specified arrays, one of the two). - Joe On Mon, Oct 27, 2008 at 7:20 PM, Peter Flom < peterflomconsulting@mindspring.com> wrote: > Akshaya <akshaya.nathilvar@GMAIL.COM> wrote > > > >I have a datafile with 100 variables, lag1-lag100. I have to calculate > >a new variable and assign a value of 1, if the value of all 100 > >variables is 1; else 0. Is there a simpler way, instead of using "IF > >lag1=1 and lag2=1 and lag3=1 and.... lag100=1". Thanks for any > >suggestions. > > > > Untested, but how about something like > > data new; > set old; > flag = 1; > array lags (100) lag1-lag100; > do i = 1 to 100; > if lags(i) ne 1 then flag = 0; > end; > > run; > > print data = new; > var flag; > run; > > > ??? > > Peter > > Peter L. Flom, PhD > Statistical Consultant > www DOT peterflom DOT com > ...

On Mon, 27 Oct 2008 15:47:50 -0700, Ramsey, Julia <Julia.Ramsey@CXTOWN.COM> wrote: >Hello, > >Assuming all numbers will sum to 100 won't work on its own, since there >could be 50 2's and 50 0's. Checking min and max wouldn't work, either, >since it wouldn't consider missing values. Combine them, though, and I >think it should work: > >if min(of lag1-lag100) = 1 and > max(of lag1-lag100) = 1 and > sum(of lag1-lag100) = 100 Here's a variation which is I think a bit more explicit vis a vis missing values and also flexible. Test this condition: min ( of lag : ) = 1 and max ( of lag : ) = 1 and nmiss ( of lag : ) = 0 >then newvar = 1; >else newvar = 0; > > >.*^*.*^*.*^*.*^*.*^*. >Julia Ramsey >Arizona Mail Order Co., Inc. >(520) 745-4500, x4149 >Julia.Ramsey@cxtown.com >-----Original Message----- >From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of >Akshaya >Sent: Monday, October 27, 2008 3:24 PM >To: SAS-L@LISTSERV.UGA.EDU >Subject: Calculating a New Variable based on existing variables in a >Datafile > >Hi all, > >I have a datafile with 100 variables, lag1-lag100. I have to calculate >a new variable and assign a value of 1, if the value of all 100 >variables is 1; else 0. Is there a simpler way, instead of using "IF >lag1=1 and lag2=1 and lag3=1 and.... lag100=1". Thanks for any >suggestio...

unfortunately not possible, if there are other possible values ne 1, e.g 99. Gerhard On Tue, 28 Oct 2008 09:04:38 -0400, Jack Clark <jclark@HILLTOP.UMBC.EDU> wrote: >Akshaya, > >If LAG1-LAG100 are numeric variables with a value of 1 or 0, you could >use the MIN function. > >newvar = min(of lag1-lag100); > > > >Jack > > > > >Jack Clark >Senior Research Analyst >phone: 410-455-6256 >fax: 410-455-6850 >jclark@hilltop.umbc.edu > >University of Maryland, Baltimore County >Sondheim Hall, 3rd Floor >1000 Hilltop Circle >Baltimore, MD 21250 > > > > >Confidentiality Notice: This e-mail may contain information that is legally privileged and that is intended only for the use of the addressee (s) named above. If you are not the intended recipient, you are hereby notified that any disclosure, copying of this e-mail, distribution, or action taken in reliance on the contents of this e-mail and/or documents attributed to this e-mail is strictly prohibited. If you have received this information in error, please notify the sender immediately by phone and delete this entire e-mail. Thank you.-----Original Message----- >From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Jim >Groeneveld >Sent: Tuesday, October 28, 2008 8:24 AM >To: SAS-L@LISTSERV.UGA.EDU >Subject: Re: Calculating a New Variable based on existing variables in a >SAS Datafile > >Hi Akshaya, > ...

I've seen lots of good ideas here=2C but I think that the fundamental probl= em is your data structure. Having all these sequential data points in a ro= w=2C labeled as you have done=2C just makes working with the data that much= harder. Leave the data in a 'tall and thin' form so that the time series nature of = the data is evident. THen use real time series approaches. Life will be e= asier in the long run. If the data are as I suggest=2C the solution is simple: PROC EXPAND. David -- David L. Cassell mathematical statistician Design Pathways 3115 NW Norwood Pl. Corvallis OR 97330 > Date: Tue=2C 28 Oct 2008 05:14:15 -0700 > From: akshaya.nathilvar@GMAIL.COM > Subject: Calculating a New Variable based on existing variables in a SAS = Datafile > To: SAS-L@LISTSERV.UGA.EDU >=20 > Hi all=2C >=20 > I have a SAS datafile with 100 variables=2C lag1-lag100. I have to > calculate a new variable and assign a value of 1=2C if the value of all > 100 variables is 1=3B else 0. Is there a simpler way=2C instead of using > "IF lag1=3D1 and lag2=3D1 and lag3=3D1 and.... lag100=3D1". Thanks for an= y > suggestions. >=20 > Thanks! > Akshaya _________________________________________________________________ Store=2C manage and share up to 5GB with Windows Live SkyDrive. http://skydrive.live.com/welcome.aspx?provision=3D1?ocid=3DTXT_TAGLM_WL_sky= drive_102008= ...

NewVar = ( ( Sum( Of Lag: ) ) = 100 ) ; Toby Dunn "Don't bail. The best gold is at the bottom of barrels of crap." Randy Pausch "Be prepared. Luck is where preparation meets opportunity." Randy Pausch > Date: Wed, 29 Oct 2008 19:55:12 -0700 > From: norcalangel@GMAIL.COM > Subject: Re: Calculating a New Variable based on existing variables in a SAS Datafile > To: SAS-L@LISTSERV.UGA.EDU > > On Oct 28, 8:14 am, Akshaya wrote: >> Hi all, >> >> I have a SAS datafile with 100 variables, lag1-lag100. I have to >> calculate a new variable and assign a value of 1, if the value of all >> 100 variables is 1; else 0. Is there a simpler way, instead of using >> "IF lag1=1 and lag2=1 and lag3=1 and.... lag100=1". Thanks for any >> suggestions. >> >> Thanks! >> Akshaya > > total=sum(of lag: ) > newvar=(total=100) _________________________________________________________________ When your life is on the go�take your life with you. http://clk.atdmt.com/MRT/go/115298558/direct/01/ "toby dunn" <tobydunn@HOTMAIL.COM> wrote in message news:BAY123-W384862DCCC45B149B087D7DE210@phx.gbl... > NewVar = ( ( Sum( Of Lag: ) ) = 100 ) ; > > > Toby Dunn If one of the lag variables has a value of 2, one has a value of 0, and the other 98 each have a value of 1, NewVar will equal 1. But it should have a value of 0 since all the lag variables must equa...

I'm going to respond to this email before reading all of it - as a thought exercise. At 17:57 +0200 4/18/06, Roy Arends wrote: >During the NSEC3 pre-workshop, we determined that the content of NSEC3's >when using the identity hash (effectively no hashing at all) are >essentially the same as NSEC. And thus the method (proving absence) used >for NSEC3 must work on NSEC as well. It does work, and I'll try to >describe here how. Off the cuff, I don't think that's a valid assertion. The reason is that NSEC deals with identities in tree-space, NSE...

Sorry for the cryptic subject, but I am trying to do the following (line numbers first) in a shell script: 15 type=AD 16 file=100000_10000_AD.csv 17 eval $type_10K=( `cat $file` ) I get the following error message: + type=AD + file=100000_10000_AD.csv combinetab.sh: line 17: syntax error near unexpected token `(' combinetab.sh: line 17: `eval $type_10K=( `cat $file` )' Isn't eval supposed to replace $type with AD and then put the contents of $file in an array names AD_10K? Thanks for any comments. -Samik Samik R. wrote: > Sorry for the cryptic subject, but I am trying to ...

The most basic way to ask my question if there is anyway of doing this would be a program that did: Dim test1 = 1 Dim test2 = 2 Dim test3 = 3 for i = 1 to 3 print testi next i Well this presents problems because it wont treat the i as a number, is there anyway of doing this? Thank you. Eric wrote: > > The most basic way to ask my question if there is anyway of doing this > would be a program that did: > > Dim test1 = 1 > Dim test2 = 2 > Dim test3 = 3 > > for i = 1 to 3 > print testi > next i You were close; all you need is brackets: dim test(3) as integer test(1) = 1 test(2) = 2 test(3) = 3 for i = 1 to 3 print test(i) next i > > Well this presents problems because it wont treat the i as a number, > is there anyway of doing this? Thank you. "Eric" <erickit@bellsouth.net> wrote in message news:bd7ac0c8.0401260942.bdbdac6@posting.google.com... > The most basic way to ask my question if there is anyway of doing this > would be a program that did: > > Dim test1 = 1 > Dim test2 = 2 > Dim test3 = 3 > > for i = 1 to 3 > print testi > next i > > Well this presents problems because it wont treat the i as a number, > is there anyway of doing this? Thank you. Not sure of the exact dialect you're looking for but: DIM test (1 to 3) test(1)=1 test(2)=2 test(3)=3 for i = 1 to 3 print test(i) next i HK ...

Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

WESTPAC is not alone in hitting its owner-occupier customers with a surprise interest rate rise, as dozens of other variable rate home loans ...

Online home rental group Airbnb is rolling out an upgraded variable pricing tool that automatically raises or cuts room rates based on supply ...

Home owners' mortgage costs are set to rise by hundreds of dollars a year, after the Commonwealth Bank became the latest bank to hike interest ...

The Commonwealth Bank to lift its home loan interest rates independently of the Reserve Bank to partially offset costs associated with stricter ...

... films and an episode of the HBO comedy series "Girls," on which he plays the role of Ray Ploshansky. New York-based creative collective Variable ...

... schedule process "carefully" and learning "a lot" from it in the past years, Mozilla has announced that Firefox is now moving to a variable ...

Writes Sarah Ketterer in The Wall Street Journal in "The ‘Wage Gap’ Myth That Won’t Die" (which you can get to without subscribing if you Google ...

... 41° Navigation Home Giants A's Sharks Warriors Kings 49ers Raiders Quakes Insiders More Tickets Shop Watch Staley: 'A lot of different variables...been ...

There are embarrassing moments in life. There is the teacher calling you out as a child in class as you stare out the window wistfully imagining ...

Resources last updated: 3/16/2016 9:36:30 PM