f



Error Base/1003 Variable does not exist: NAME (Aieeee!)

Hi Folks,

I hope someone can help me see through the glue.... I seem to be looking at the 
SAME few possibiliteis over and over again and cannot find my screw-up. I need a
fresh look.

I have a routein that uses four (4) large files that are linked togeher with
common index fields.

At one point, if the variables call for it, this routein needs to open a fifth
database and append a new record.
When the rroutein gets to the statement ...  5->( dbcommit() ) ... I will get
this error:
Error Base/1003 Variable does not exist: NAME

My only notion is that the active pointer isn't looking at the right area. I've
pasted the code below because I MUST not really be looking at the right area
but the code looks clear to me:

:::
// There are four (4) open tables
:::
IF < conditions is true >
	USE cNewFileName
	WHILE( iMore=.t.)
		IF 5->( flock() )
			APPEND BLANK
			5->name	:=cName
			5->address	:=cAddress
			5->phone	:=cPhonae
			5->( dbcommit() )
			5->( dbunlock() )
			iMore		:=.f.
		ELSE
			LOOP
		END
	ENDDO
	DBCLOSEAREA(5)
	DBSELECTAREA(4)
END
:::
:::
:::

How do I miss? Why would the program still think its in WorkArea 4, or 
WorkArea 3 or wherever the hell it thinks it is??

By the way, a blank record is appended to area-5


Many many thanks

Paul
0
bruneaup (2)
11/16/2003 6:36:08 PM
comp.lang.clipper 3959 articles. 0 followers. Post Follow

9 Replies
3825 Views

Similar Articles

[PageSpeed] 13

hi,

> // There are four (4) open tables
> :::
> IF < conditions is true >
> USE cNewFileName

you have not SELECT 5 nor used USE xxx NEW or ALIAS ?!
use the Debugger to see if your ALIAS() is active.

it isn�t a good idee to use a "number" as ALIAS

greetings by OHR
Jimmy





0
AUGE_OHR (177)
11/16/2003 7:11:20 PM
Paul

Are you actually putting a select 5 above that first if statement?

Are you checking with NetErr() to see if the file opened ok?

pt

"Paul Bruneau" <bruneaup@NO_SPAM_rogers.com> wrote in message
news:53efrvk29ur8itbh4tgfql0588a08pposs@4ax.com...
> Hi Folks,
[...]
> :::
> // There are four (4) open tables
> :::
> IF < conditions is true >
> USE cNewFileName
> WHILE( iMore=.t.)
> IF 5->( flock() )
> APPEND BLANK
> 5->name :=cName
> 5->address :=cAddress
> 5->phone :=cPhonae
> 5->( dbcommit() )
> 5->( dbunlock() )
> iMore :=.f.
> ELSE
> LOOP
> END
> ENDDO
> DBCLOSEAREA(5)
> DBSELECTAREA(4)
> END
> :::
> :::
> :::
>
> How do I miss? Why would the program still think its in WorkArea 4, or
> WorkArea 3 or wherever the hell it thinks it is??
>
> By the way, a blank record is appended to area-5
>
>
> Many many thanks
>
> Paul


0
11/16/2003 7:39:57 PM
Paul,

I see now you say the blank is being appended.

Do you have a 'fields' list for this table in the code?

pt


0
11/16/2003 7:43:03 PM
As I can see it you are opening the file in the area where you are running.
Area 5 will be empty.  Try inserting the line below:

IF < conditions is true >
  sele 5                                 //insert this line
  USE cNewFileName

Jos�

"Paul Bruneau" <bruneaup@NO_SPAM_rogers.com> wrote in message
news:53efrvk29ur8itbh4tgfql0588a08pposs@4ax.com...
> Hi Folks,
>
> I hope someone can help me see through the glue.... I seem to be looking
at the
> SAME few possibiliteis over and over again and cannot find my screw-up. I
need a
> fresh look.
>
> I have a routein that uses four (4) large files that are linked togeher
with
> common index fields.
>
> At one point, if the variables call for it, this routein needs to open a
fifth
> database and append a new record.
> When the rroutein gets to the statement ...  5->( dbcommit() ) ... I will
get
> this error:
> Error Base/1003 Variable does not exist: NAME
>
> My only notion is that the active pointer isn't looking at the right area.
I've
> pasted the code below because I MUST not really be looking at the right
area
> but the code looks clear to me:
>
> :::
> // There are four (4) open tables
> :::
> IF < conditions is true >
> USE cNewFileName
> WHILE( iMore=.t.)
> IF 5->( flock() )
> APPEND BLANK
> 5->name :=cName
> 5->address :=cAddress
> 5->phone :=cPhonae
> 5->( dbcommit() )
> 5->( dbunlock() )
> iMore :=.f.
> ELSE
> LOOP
> END
> ENDDO
> DBCLOSEAREA(5)
> DBSELECTAREA(4)
> END
> :::
> :::
> :::
>
> How do I miss? Why would the program still think its in WorkArea 4, or
> WorkArea 3 or wherever the hell it thinks it is??
>
> By the way, a blank record is appended to area-5
>
>
> Many many thanks
>
> Paul


0
jcarvalho (9)
11/16/2003 8:24:13 PM
Paul

The simplest way is to avoid using workarea numbers
Eg
> USE cNewFileName ALIAS 'XXXX' NEW
> WHILE( iMore=.t.)
> IF XXXX->( flock() )
> APPEND BLANK
> XXXX->name :=cName


--
HTH
Steve Quinn


0
steveqNOSPAM (402)
11/16/2003 11:11:35 PM
Paul,

Greetings,

It isn't clear what workarea is in use when ( USE cNewFileName ) is
called, if the current workarea is (3) or (4) then cNewFileName will
open in THAT workarea (and the current database opened at time of (USE
cNewFileName) will be closed), fyi.

How about: 

> IF < conditions is true >

        nSelect := SELECT() // save current workarea context (new)..
      
        // *** select workarea (5), open database, output record !

        SELECT 5   // new - FORCE workarea (5) as current workarea..

> 	USE cNewFileName

        IF NETERR()
           ALERT( "Could not open: " + cNewFileName + " for APPEND !"
)
           iMore := .F.
        ENDIF  // new - error checking code..

> 	WHILE( iMore=.t.)
> 		IF 5->( flock() )
> 			APPEND BLANK
> 			5->name	:=cName
> 			5->address	:=cAddress
> 			5->phone	:=cPhonae
> 			5->( dbcommit() )
> 			5->( dbunlock() )
> 			iMore		:=.f.   
> 		ELSE
                        // might want to put a retry alert w/ (delay)
here,
                        // ALERT( "Waiting for: " + cNewFileName + "
lock.." )
                        // Inkey(.5)
                        // nDelay += .5   // c/b used to show retry to
user..
> 			LOOP
> 		END
> 	ENDDO

        IF ! ( ALIAS(5) == "" )
           5->( DBCLOSEAREA() )    //  DBCLOSEAREA(5) is wrong
syntax..
        ENDIF // close (cNewFileName), if we were able to USE it..

        SELECT ( nSelect )  // restore previous workarea context (s/b
4) ..

  	//  DBSELECTAREA(4)  // above SELECT statment should put back to
(4)??

> END


I hope the above helps.

Regards,
Bob


Paul Bruneau <bruneaup@NO_SPAM_rogers.com> wrote in message news:<53efrvk29ur8itbh4tgfql0588a08pposs@4ax.com>...
> Hi Folks,
> 
> I hope someone can help me see through the glue.... I seem to be looking at the 
> SAME few possibiliteis over and over again and cannot find my screw-up. I need a
> fresh look.
> 
> I have a routein that uses four (4) large files that are linked togeher with
> common index fields.
> 
> At one point, if the variables call for it, this routein needs to open a fifth
> database and append a new record.
> When the rroutein gets to the statement ...  5->( dbcommit() ) ... I will get
> this error:
> Error Base/1003 Variable does not exist: NAME
> 
> My only notion is that the active pointer isn't looking at the right area. I've
> pasted the code below because I MUST not really be looking at the right area
> but the code looks clear to me:
> 
> :::
>  // There are four (4) open tables
> :::
> IF < conditions is true >
> 	USE cNewFileName
> 	WHILE( iMore=.t.)
> 		IF 5->( flock() )
> 			APPEND BLANK
> 			5->name	:=cName
> 			5->address	:=cAddress
> 			5->phone	:=cPhonae
> 			5->( dbcommit() )
> 			5->( dbunlock() )
> 			iMore		:=.f.
> 		ELSE
> 			LOOP
> 		END
> 	ENDDO
> 	DBCLOSEAREA(5)
> 	DBSELECTAREA(4)
> END
> :::
> :::
> :::
> 
> How do I miss? Why would the program still think its in WorkArea 4, or 
> WorkArea 3 or wherever the hell it thinks it is??
> 
> By the way, a blank record is appended to area-5
> 
> 
> Many many thanks
> 
> Paul
0
11/17/2003 1:24:56 AM
Hi Paul!

the APPEND BLANK is executed in the previous workarea (in fact, not in "5").
the replace statements should work ok (because of the flock), but they are
executed in the first record of "5" because of your code design. This
database is not positioned in any record if it is an empty database, where
recno=0; or at the very beggining, where recno=1 (assuming no index files
opened, will depend on the rdd used).
no idea why are you getting that message after commit, but there are two or
more reasons to fail (at least, maybe more).

Check your code and try again, after reading the other posts...

HTH
-- 
Saluten
Claudio
Buenos Aires - Argentina
--
"Lo importante no es saber, sino tener el telefono del que sabe"

"Paul Bruneau" <bruneaup@NO_SPAM_rogers.com> escribi� en el mensaje
news:53efrvk29ur8itbh4tgfql0588a08pposs@4ax.com...
| Hi Folks,
|
| I hope someone can help me see through the glue.... I seem to be looking
at the
| SAME few possibiliteis over and over again and cannot find my screw-up. I
need a
| fresh look.
|
| I have a routein that uses four (4) large files that are linked togeher
with
| common index fields.
|
| At one point, if the variables call for it, this routein needs to open a
fifth
| database and append a new record.
| When the rroutein gets to the statement ...  5->( dbcommit() ) ... I will
get
| this error:
| Error Base/1003 Variable does not exist: NAME
|
| My only notion is that the active pointer isn't looking at the right area.
I've
| pasted the code below because I MUST not really be looking at the right
area
| but the code looks clear to me:
|
| :::
| // There are four (4) open tables
| :::
| IF < conditions is true >
| USE cNewFileName
| WHILE( iMore=.t.)
| IF 5->( flock() )
| APPEND BLANK
| 5->name :=cName
| 5->address :=cAddress
| 5->phone :=cPhonae
| 5->( dbcommit() )
| 5->( dbunlock() )
| iMore :=.f.
| ELSE
| LOOP
| END
| ENDDO
| DBCLOSEAREA(5)
| DBSELECTAREA(4)
| END
| :::
| :::
| :::
|
| How do I miss? Why would the program still think its in WorkArea 4, or
| WorkArea 3 or wherever the hell it thinks it is??
|
| By the way, a blank record is appended to area-5
|
|
| Many many thanks
|
| Paul


0
mixxell (95)
11/17/2003 4:54:24 AM
Paul,

Paul Bruneau wrote:

> Hi Folks,
>
> I hope someone can help me see through the glue.... I seem to be looking at the
> SAME few possibiliteis over and over again and cannot find my screw-up. I need a
> fresh look.
>
> I have a routein that uses four (4) large files that are linked togeher with
> common index fields.
>
> At one point, if the variables call for it, this routein needs to open a fifth
> database and append a new record.
> When the rroutein gets to the statement ...  5->( dbcommit() ) ... I will get

Is this an example of your actual code?  Have you not heard of using aliases ?

>
> this error:
> Error Base/1003 Variable does not exist: NAME



> My only notion is that the active pointer isn't looking at the right area. I've
> pasted the code below because I MUST not really be looking at the right area
> but the code looks clear to me:

What about the structure of the data table that you're opening in workarea 5? Have
you examined it?  What is that structure ?


>
>
> :::
> // There are four (4) open tables
> :::
> IF < conditions is true >
>         USE cNewFileName
>         WHILE( iMore=.t.)
>                 IF 5->( flock() )

Why are you locking the whole file?


>                         APPEND BLANK
>                         5->name :=cName
>                         5->address      :=cAddress
>                         5->phone        :=cPhonae
>                         5->( dbcommit() )
>                         5->( dbunlock() )
>                         iMore           :=.f.
>                 ELSE
>                         LOOP
>                 END
>         ENDDO
>         DBCLOSEAREA(5)
>         DBSELECTAREA(4)
> END
> :::
> :::
> :::
>
> How do I miss? Why would the program still think its in WorkArea 4, or
> WorkArea 3 or wherever the hell it thinks it is??
>
> By the way, a blank record is appended to area-5
>
> Many many thanks
>
> Paul

--
g.
Gary Stark
gstark@RedbacksWeb.com
http://RedbacksWeb.com


0
Bogus4Swen (57)
11/17/2003 5:03:54 AM
What you have here is conflicting/ambiguous work areas.  You're opening a
table without specifically selecting work area 5, but you're assuming it is
open in work area 5. You never select work area 5, so the unaliased append
blank command will append a blank record to whatever table is in the current
work area - i.e., the cNewFileName.  If what you're saying is true, I'm
surprised you don't get errors when using any 5-> reference.  So,
apparently, there is a table open in area 5, but whatever table it is
doesn't have a name field.  At any rate you should be consistent with your
aliasing.

5->dbUseArea(.f.,,(cNewFileName))
5->( dbAppend() )
if ! neterr()
    5->name :=cName
    5->address :=cAddress
    5->phone :=cPhonae
    5->( dbcommit() )
    5->( dbunlock() )
endif

You really must put parens () around variable names [or use the macro
operator] that contain table names or you'll end up opening a table named
CNEWFILE instead.  I'd also be surprised that locking the table simply to
append a record is a horrible waste of resources.  What happens if more that
one person want to append or one person wants to edit a record while another
wants to append.  Record locks are sufficient for appends, and dbAppend does
an automatic record lock.


"Paul Bruneau" <bruneaup@NO_SPAM_rogers.com> wrote in message
news:53efrvk29ur8itbh4tgfql0588a08pposs@4ax.com...
> Hi Folks,
>
> I hope someone can help me see through the glue.... I seem to be looking
at the
> SAME few possibiliteis over and over again and cannot find my screw-up. I
need a
> fresh look.
>
> I have a routein that uses four (4) large files that are linked togeher
with
> common index fields.
>
> At one point, if the variables call for it, this routein needs to open a
fifth
> database and append a new record.
> When the rroutein gets to the statement ...  5->( dbcommit() ) ... I will
get
> this error:
> Error Base/1003 Variable does not exist: NAME
>
> My only notion is that the active pointer isn't looking at the right area.
I've
> pasted the code below because I MUST not really be looking at the right
area
> but the code looks clear to me:
>
> :::
> // There are four (4) open tables
> :::
> IF < conditions is true >
> USE cNewFileName
> WHILE( iMore=.t.)
> IF 5->( flock() )
> APPEND BLANK
> 5->name :=cName
> 5->address :=cAddress
> 5->phone :=cPhonae
> 5->( dbcommit() )
> 5->( dbunlock() )
> iMore :=.f.
> ELSE
> LOOP
> END
> ENDDO
> DBCLOSEAREA(5)
> DBSELECTAREA(4)
> END
> :::
> :::
> :::
>
> How do I miss? Why would the program still think its in WorkArea 4, or
> WorkArea 3 or wherever the hell it thinks it is??
>
> By the way, a blank record is appended to area-5
>
>
> Many many thanks
>
> Paul


0
nospam (2804)
11/17/2003 7:00:10 AM
Reply:

Similar Artilces:

naming a new variable based on the name of an existing variable
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 ...

I got error saying saying a variable does not exist in the dataset, but the variable does exist in the dataset.
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 $...

Assign variables to a new variable based on variable names in SAS
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", "...

How to create required format variable based on the variable name and variable birthday
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! ...

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 #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 #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: 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: Calculating a New Variable based on existing variables in a
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 ...

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

actual for variable name must be variable compiler error
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...

Re: Calculating a New Variable based on existing variables in a #7
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 ...

Calculating a New Variable based on existing variables in a SAS Datafile
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...

automatically create a new variable name based on macro variable
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...

Re: Calculating a New Variable based on existing variables in a #5
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 ...

Re: Calculating a New Variable based on existing variables in a #3
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 > ...

Re: Calculating a New Variable based on existing variables in a #9
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...

Re: Calculating a New Variable based on existing variables in a #8
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, > ...

Re: Calculating a New Variable based on existing variables in a #12
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= ...

Re: Calculating a New Variable based on existing variables in a #11
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...

Re: proving NAME ERROR (was: Re: [dns-operations] NXDOMAIN vs NODATA for suffixes of existing name)
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...

Variable variable name
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 ...

Variables in Variable Name
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 ...

Web resources about - Error Base/1003 Variable does not exist: NAME (Aieeee!) - comp.lang.clipper

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

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

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

Commonwealth Bank raises variable home loan rates
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 ...

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

Washington Square Signs Spielbergs, Choi Joins Variable and More
... 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 ...

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

"You have to ignore many variables to think women are paid less than men. California is happy to try." ...
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 ...

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

When your environment variables are showing
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