Re: how to generate an array in sas?

  • Permalink
  • submit to reddit
  • Email
  • Follow


lixiaoyao5880@YAHOO.COM wrote:
>   how to generate a array in sas,I want an array from 1 to 508.

I'm sorry, but I can't tell whatyou're after.

Are you trying to create one record with numbers from 1 to 508, in variables
that
have names like, say, V1 to V508?


  array vv{508} v1-v508;
  do _i = 1 to dim(vv);
    vv{_i} = _i;
    end;


Or are you trying to create records which are numbered from 1 to 508?


  do reccount = 1 to 508;
    output;
    run;


In SAS, the word ARRAY has a specific meaning in the data step.  But in lots
of
other places, 'array' means something else.  Could you write back and be
more
specific?

David
--
David L. Cassell
mathematical statistician
Design Pathways
3115 NW Norwood Pl.
Corvallis OR 97330

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
0
Reply davidlcassell (5567) 12/4/2005 6:39:48 AM

See related articles to this posting


  hi david
  Thanks a lot,I just send you an email,could you please answer my
question? Thanks a lot

0
Reply lixiaoyao5880 (132) 12/4/2005 7:26:32 AM
comp.soft-sys.sas 131222 articles. 29 followers. Post

1 Replies
142 Views

Similar Articles

[PageSpeed] 41


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

Re: how to generate an array in sas? #2
lixiaoyao5880@YAHOO.COM wrote back to me: > hi david > Thanks a lot,I just send you an email,could you please answer my >question? Thanks a lot Your email to me went right into my spam filter. Sorry. I imagine it was because of the 36K file you went me (not to SAS-L) that was almost all data. Please don't do that anymore. In the meantime, I see that several SAS gurus have answered your immediate question. But I don't think this is the quesiton you really need answered. If you are, in fact, trying to write your own lags so that you will have lagged-by-one data for mod...

Re: how to generate an array in sas? #3
lixiaoyao5880@yahoo.com wrote to me personally, instead of to SAS-L: > I think the model I wrote to you is called Poisson regression models >in time series. > Could you help me on this? Thanks a lot You really need to write to SAS-L, instead of to me personally. I *really* don't think you have a Poisson regression model. You *may* have a time series problem, although I cannot tell, since you haven't told anyone what your data actually *are*. Your variable A1, which you have described as some kind of 'mortality', seems to be a bunch of numbers between 150 and 20...

RE : Re: RE : Re: copulas and SAS
Thanks, I appreciate your comments,I understand that copula is not the appropriate tool to use, what will be the alternative ? Adel David L Cassell <davidlcassell@MSN.COM> a �crit : joewhitehurst@GMAIL.COM replied: > >Adel, > >You may find the following artilce interesting. [article by Thomas Mikosch not copied] This is a really good article, and a really useful point to make. But 55K is a lot of article to copy. Would it have been easier to point to a URL? The people who read SAS-L as a digest and the people who have slow connections are probably not overly thrilled...

Re: show array of array of array of array...
sorry..the code: function printtree($array, $level){ while(list($k,$v) = each($array)) if(is_array($k)){ print("$k -><br>"); printtree($k,$level++); } else { for($i=0;$i<$level;$i++) print("&nbsp;"); print("$k : $v<br>"); } } but it does only print the first level and get out !!! I can't figure what's wrong.... Please help !!!! BoB Bob Bedford wrote: > sorry..the code: > > function printtree($array, $level){ > while(list($k,$v) = each($array)) > if(is_array($k)){ > print(&quo...

Re: urgent : Convert SAS array in to sas variables
Shailesh, Why would you want to do what you ask? What you are asking would create the variable for all observations, but the variables' values would be missing values for every observation except the one on which it is based. Art ----- 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 .......... >...

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

how to generate an array in sas?
Hi all how to generate a array in sas,I want an array from 1 to 508. Thanks ...

Re: RE : Re: SAS on a Mac
Not sure why this has spawned 3 threads: http://listserv.uga.edu/cgi-bin/wa?A1=ind0704e&L=sas-l#21 ...

Re: SAS + ARRAY
Ravi, You don't need an array and yes macro code will work here easily: %macro count(camp_num=); proc sql; create table Count_var as select count (distinct (CIN )) as N from table where campaign_&camp_num is not null; quit; %mend count; %macro loop(start=,stop=); %do I = &start %to &stop; %count(camp_num=&i); %end; %mend loop; %loop(start=1,stop=100); HTH Toby Dunn -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of ravi Sent: Monday, August 02, 2004 11:07 AM To: SAS-L@LISTSERV.UGA.EDU Subject: SAS + ARRAY I have 100...

Re: Generating arrays
Amrita, A sample data set and the required output will find you faster solution . Muthia Kachirayan On 7/5/07, Amrita Singh <amritas2@aol.com> wrote: > > Hi, > > I have a situation where I have to accumulate hundreds of variables that > are in an several arrays. Some arrays have 10 elements whereas other?arrays > may have 80 elements.? > ?? > An?input array may look like this: > > Array?inpvars (*) dollar6mo dollar12mo?items6mo?items12mo ..etc; > > I have to generate an output array?which looks like this: > > array outvars(*) t_dollar6mo t_dol...

Re: RE : Re: copulas and SAS
Adel, Think Joke! But, more seriously, it did prompt me to look up the origins of the copula as a functional. Joe On 9/27/06, adel F. <adel_tangi@yahoo.fr> wrote: > > Hi, > I do not know how this is related to my orginal question. > > My understanding of copula is, it is a joint distribution with uniform > margins, the problem how to obtain a copula which fits better a data? > > If there is any suggestion from members of SAS list, about examples for > copulae with SAS, I will appreciate that > > Thanks a lot > > Adel > Joe Whitehurst <joew...

Re: SAS Arrays
Code using array is possible. Fix what variables you need to have. Set a sample input dataset and the OUTPUT that you want to derive out of it. Muthia Kachirayan On 10/29/07, Jamie Henderson <jamie.henderson@lloydstsb.co.uk> wrote: > > Apologies for the newbie question, but I was hoping someone will be able > to help with some code I want to write. > > I have monthly account history files going back a few years. I want to > create 1 ever expanding file that contains a couple of pieces of data that > will never change (customer reference number, original borrowing ...

Re: SAS Generated,
One caveat I forgot. The polling instrument will be easier to manage if you reduce the font size in your browser so that all 20 reference axes and the navigation controls are visible on a single page. Otherwise you will have to page down and up as each person is presented. On Sun, Jul 5, 2009 at 8:43 PM, Joe Whitehurst <joewhitehurst@gmail.com>wrote: > This objective presidential poll is unlike any you have ever seen. Unlike > every other presidential poll you have ever encountered which have no > theory to guide their construction, analysis or intrepretation, this > obj...

RE: Generator not generating
Jeff Lowery wrote: > def plot_dist(self): > file =3D None; >=20 > file =3D nextFile().next() # call to generator here ^^^^^^^^^^ > I trace through this in the debugger and the call to nextFile().next() > always starts at the beginning of the function (it always returns the > first file in C:/somedir). >=20 > So what stoopid mistake am I overlooking here? I am running v2.3, BTW. You're restarting the generator every time ... Tim Delaney ...

Re: array of array?
Hi guys, I have a problem... Suppose to have these easy lines: a=[1,2]; b=[5,8]; temp=[a,b]; I used disp(temp(1)) but it not show the first element of temp,that is what I want!!! How I can do? Thx.. Raffaele ...

Re: Generating arrays #5
Hi, I'm not sure why my posting was all messed up - probably the browser I'm using. I like your suggestion of using the second array to do the accumulations...that will work great. Now I just have to get over the hurdle of generating the second array definition which is based on the first array with a prefix. The reason being that I dont want to?manually affix the T_ in front of the hundreds of variables. I was looking for help with some macro code to do that. Thanks for your help. Amrita -----Original Message----- From: Nathaniel.Wooding@dom.com To: amritas2@AOL.COM Cc: SAS...

Re: Generating arrays #9
Nat, Muthia: Thanks so much for your help -?I used your suggestions and got the?results I was looking for. Thanks again, Amrita -----Original Message----- From: Muthia Kachirayan <muthia.kachirayan@gmail.com> To: amritas2@aol.com Cc: SAS-L@listserv.uga.edu Sent: Sat, 7 Jul 2007 2:39 pm Subject: Re: Generating arrays Amrita, Borrowing the idea of Nat here is how it is: data a; infile cards;?????? input custnum dollars items; CARDS;????????????????????????? 5 2 7?????????????????????????? 5 1 0?????????????????????????? 6 2 3?????????????????????????? 6 8 1????????????????????...

Re: Generating arrays #4
Amrita When I received your posting, all of the color was gone and the text was a bit messed up. Try the following code and see how well it works for you. Note that I put in two arrays. The first you already had and that initializes the totals array. The second does the addition. I did this since if you have hundreds of variables, it will be easier to do the addition in the second array. The place where I would mess up if I were doing this would be in matching the elements in the two arrays -- sort of , if I had variables a and b, I would probably write the array amts b a; array tamts a b; ...

Re: SAS + ARRAY #2
On Mon, 2 Aug 2004 09:06:59 -0700, ravi <get_sravikumar@REDIFFMAIL.COM> wrote: >I have 100 campaigns... in the following form. >Campaign_1, Campaign_2 .... Campaign_100. These are columns in a file. >Each of these campaigns contain a certain number of customers. These >numbers change on the monthly basis. My purpose is to find the number >of customers in all these campaigns .. each month. >Objective: >Instead of writing this code 100 times for hundred campaigns, I would >like to see ONE report, which has number of customers for all the >campaigns, beginning...

Re: SAS + ARRAY #3
It could be done in a DATA step, using arrays. But if there are multiple observations for some of the CIN values (which is suggested by the use of the DISTINCT keyword in Ravi's SQL code), it may be tricky. Test data: data campaigns; input cin $ counter campaign_1 campaign_2; cards; A 1 1 . B 1 1 . A 2 1 1 ; I suggest back-to-back PROC SUMMARY steps. First: proc summary data=campaigns nway; class cin; var campaign_ : ; output out=halfdone min=; run; Result: campaign_ campaign_ Obs cin _TYPE_ _FREQ...

Re: sas arrays #8
MT, It sounds like this might be more of a task for PROC IML than a data = step (arrays are called matrixes in IML). Matrixes can be of varying = number of elements. Note that all variables represent a matrix in IML- though the "matrix" = can be 1 by 1, which is essentially a variable like it would be in other = languages. You can pass a variable into a procedure; I'm not quite sure = about the relationships of local variables to global variables like = there are in other language like PL/1. You can also use a macro = variable in IML. Here are some examples of IML that mig...

Re: Use of a sas array
Hi Kende, Is this what you are looking for? This is assuming that the dimensions for array T1 and array T2 are the same. data have; input x1 x2 x3 n1 n2 n3; array T1(3) x1 x2 x3; array T2(3) n1 n2 n3; do _n_=1 to dim(T1); tot = sum(tot,T1[_n_]*T2[_n_] ); end ; cards; 14 6 0 3 2 0 10 7 3 3 2 1 11 5 4 4 2 2 15 2 3 3 1 1 14 3 3 1 1 1 ;run; Output: Obs x1 x2 x3 n1 n2 n3 tot 1 14 6 0 3 2 0 54 2 10 7 3 3 ...

Re: sas arrays #5
On Wed, Mar 5, 2008 at 4:30 PM, MT <mgteixeira@gmail.com> wrote: > Hi, > > I want to be able to manipulate SAS arrays, i.e., adding and removing > elements from an array. Is this possible? it won't be dynamic like in PERL. the size of the array has to be defined first. you can set one of the element to NULL. But as i said, it won't act like auto shrink. > > > Is it possible to define variable-length arrays? I don't know the > final size of an array before doing some processing, and would want > the values to be added to it iteratively. Do you...

Re: sas arrays #7
MT wrote: > Hi, > > I want to be able to manipulate SAS arrays, i.e., adding and removing > elements from an array. Is this possible? > > Is it possible to define variable-length arrays? I don't know the > final size of an array before doing some processing, and would want > the values to be added to it iteratively. Do you know if this is > possible? > > Also, is it possible to redefine a value inside an array at a given > position? The size (number of elements) of a SAS array created with the ARRAY statement is fixed at compile time. The HASH componen...