From: Sdlentertd on
On Dec 16, 12:29 pm, barry.a.schw...(a)BOEING.COM ("Schwarz, Barry A")
wrote:
> Arrays are not related to datasets but to variables.  It is perfectly acceptable to have multiple arrays dealing with different variables, such as
>
>     ARRAY a_array(*) $ var_a1-var_a9;
>     ARRAY b_array(*) var_b1-var_b23;
>
> Different arrays can have different dimensions (9 vs 23 in the example) and types (character vs numeric).
>
> Date9. is a format which has nothing to do with arrays.  It only affects how a numeric variable is converted to a character string in the PUT function or the PUT statement.  (Date and time variables are just normal numeric variables with special meanings attached to the values.)
>
>
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SA...(a)LISTSERV.UGA.EDU] On Behalf Of Sdlentertd
> Sent: Tuesday, December 15, 2009 11:57 AM
> To: SA...(a)LISTSERV.UGA.EDU
> Subject: Re: Array use?
>
> <snip>
>
> This is great and works, but
> what if one of the fields that has to be in array is in different
> format than the other, for example: ID1 is character but another field
> is Date which is Date9. and another field Price which is numeric....
> How do i put them all in one array?  or how can I do two seperate
> arrays for one dataset?  Thank you- Hide quoted text -
>
> - Show quoted text -
But the statements bellow do not work
array a_ID(*) $ ID1-ID10; (character)
array b_ID(*) ID1-ID10; (numeric)
Error message: All variables in array list must be the same type,
i.e., all numeric or character.

From: "Schwarz, Barry A" on
Shoot the person who designed your data set.

-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L(a)LISTSERV.UGA.EDU] On Behalf Of Sdlentertd
Sent: Wednesday, December 16, 2009 1:08 PM
To: SAS-L(a)LISTSERV.UGA.EDU
Subject: Re: Array use?

<SNIP>

> This is great and works, but
> what if one of the fields that has to be in array is in different
> format than the other, for example: ID1 is character but another field
> is Date which is Date9. and another field Price which is numeric....
> How do i put them all in one array? or how can I do two seperate
> arrays for one dataset? Thank you- Hide quoted text -
>
> - Show quoted text -
But the statements bellow do not work
array a_ID(*) $ ID1-ID10; (character)
array b_ID(*) ID1-ID10; (numeric)
Error message: All variables in array list must be the same type,
i.e., all numeric or character.
From: xlr82sas on
On Dec 16, 3:13 pm, barry.a.schw...(a)BOEING.COM ("Schwarz, Barry A")
wrote:
> Shoot the person who designed your data set.
>
>
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SA...(a)LISTSERV.UGA.EDU] On Behalf Of Sdlentertd
> Sent: Wednesday, December 16, 2009 1:08 PM
> To: SA...(a)LISTSERV.UGA.EDU
> Subject: Re: Array use?
>
> <SNIP>
>
> > This is great and works, but
> > what if one of the fields that has to be in array is in different
> > format than the other, for example: ID1 is character but another field
> > is Date which is Date9. and another field Price which is numeric....
> > How do i put them all in one array?  or how can I do two seperate
> > arrays for one dataset?  Thank you- Hide quoted text -
>
> > - Show quoted text -
> But the statements bellow do not work
>  array a_ID(*) $ ID1-ID10; (character)
> array b_ID(*)  ID1-ID10; (numeric)
> Error message: All variables in array list must be the same type,
> i.e., all numeric or character.- Hide quoted text -
>
> - Show quoted text -

OFF TOPIC SIDE NOTE

I do not believe SAS is the best solution for all problems. Although
I believe a 'complete SAS system' (BASE,ML,SCL,STAT, GRAPH,QC,ETS,OR)
covers more territory then most.

PERL allows the construct below. ( I don't think you can do this with
SCL lists). An array of mixed types, here every third element is a
string.

@array = (1, 2, 'Hello',3,4,"Goodyby");

Another nice feature of PERL is the ability to treat an entire file
like a single string. This is very powerful.

I like to use PERL occassionally.
From: montura on
Use two arrays AND shoot the person who designed the data feeds.

Before reading the data into that data step, make sure the typecast on
ID columns, Code columns, and Claim columns match.
What ever does not match - use a separate data step to change it to/
from char/num.



From: Joe Whitehurst on
On Thu, Dec 17, 2009 at 1:09 AM, xlr82sas <xlr82sas(a)aol.com> wrote:

> On Dec 16, 3:13 pm, barry.a.schw...(a)BOEING.COM ("Schwarz, Barry A")
> wrote:
> > Shoot the person who designed your data set.
> >
> >
> >
> > -----Original Message-----
> > From: SAS(r) Discussion [mailto:SA...(a)LISTSERV.UGA.EDU] On Behalf Of
> Sdlentertd
> > Sent: Wednesday, December 16, 2009 1:08 PM
> > To: SA...(a)LISTSERV.UGA.EDU
> > Subject: Re: Array use?
> >
> > <SNIP>
> >
> > > This is great and works, but
> > > what if one of the fields that has to be in array is in different
> > > format than the other, for example: ID1 is character but another field
> > > is Date which is Date9. and another field Price which is numeric....
> > > How do i put them all in one array? or how can I do two seperate
> > > arrays for one dataset? Thank you- Hide quoted text -
> >
> > > - Show quoted text -
> > But the statements bellow do not work
> > array a_ID(*) $ ID1-ID10; (character)
> > array b_ID(*) ID1-ID10; (numeric)
> > Error message: All variables in array list must be the same type,
> > i.e., all numeric or character.- Hide quoted text -
> >
> > - Show quoted text -
>
> OFF TOPIC SIDE NOTE
>
> I do not believe SAS is the best solution for all problems. Although
> I believe a 'complete SAS system' (BASE,ML,SCL,STAT, GRAPH,QC,ETS,OR)
> covers more territory then most.
>
> PERL allows the construct below. ( I don't think you can do this with
> SCL lists). An array of mixed types, here every third element is a
> string.
>
> Oh yes you can easily do this with SCL Lists. You can even give each
element (which can be up to 32,766 characters long) of a list a name (up to
256 bytes long) and you can use the same name for multiple elements using
any characters on the keyboard. You can also retrieve the value of a SCL
element List by its name and you can sort a SCL list by element names or
values. And, an element of a SCL List can be another list. You can also
save a SCL list to disk to be used in subsequent SAS sessions
Limitless Levels of Nesting

Nested lists are highly useful for creating collections of records or data
structures. There is no limit to the amount of nesting or to the number of
sublists that can be placed in a list, other than the amount of memory
available to your SAS application. Further, you can create recursivelist
structures, where the list A can contain other lists that contain A either
directly or indirectly. The list A can even contain itself as a list item.


> @array = (1, 2, 'Hello',3,4,"Goodyby");
>
> Another nice feature of PERL is the ability to treat an entire file
> like a single string. This is very powerful.
>

This is also easily accomplished with SAS. Just give the file the RECFM=N
attribute. Then SAS treats the entire file as a stream of bytes.

>
> I like to use PERL occassionally.
>
First  |  Prev  |  Next  |  Last
Pages: 1 2 3
Prev: sample size determination
Next: About sgpanel