Date: Tue, 8 Jan 2008 10:53:23 -0600
Reply-To: "data _null_," <datanull@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "data _null_," <datanull@GMAIL.COM>
Subject: Re: Can you do array processing and a proc nlp from within proc
iml?
In-Reply-To: <200801081630.m08BuH87009685@malibu.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1
I think, you want to create a SAS data set from a matrix...
Creating a SAS Data Set from a Matrix
SAS/IML software provides the ability to create a new SAS data set
from a matrix. Use the CREATE and APPEND statements to create a SAS
data set from a matrix, where the columns of the matrix become the
data set variables and the rows of the matrix become the observations.
Thus, an n Śm matrix creates a SAS data set with m variables and n
observations. The CREATE statement opens the new SAS data set for both
input and output, and the APPEND statement writes to (outputs to) the
data set.
Then use that data set as input to PROC NLP.
On Jan 8, 2008 10:30 AM, Randall Powers <powers_r@bls.gov> wrote:
> Sorry this is rambling and longwinded. Any input anybody can give would be
> helpful! If what I'm saying/asking doesn't make sense, it's probably
> because of my newbieness...I'd be happy to clarify.
>
> So here is what I'm doing.
>
> I'm using proc iml to create a matrix of values. The number of columns and
> rows may vary, but for arguments sake, let's say 50 rows and 5 columns. I'm
> using RANDMULTIMOMIAL to create matrix X, which is 50x5. What I'd like to
> do is somehow convert that matrix into a 50x5 array (50 rows, 5 columns),
> which I would then use as input in a proc nlp.
>
> For example:
>
> 5 4 6 2 5
> 4 5 4 4 5
> 3 7 3 6 3
> .........
> .........
> etc
>
> Does this seem possible? Can it all be done in the proc iml, or do I have
> to break it up and do it outside of proc iml?
>
> One thing I did try was to create an output file which I'm thinking could
> then be used to read the values of X into an array in a data step. The
> output file created from proc iml assigns each value of the matrix a
> separate observation. Thus, the example below gives a SAS data set with:
>
> OBS X
> 1 5
> 2 4
> 3 6
> 4 2
> 5 5
> 6 4
> 7 5
> 8 4
> 9 4
> 10 5
> etc. (in this example, I would have 50x5=250 obs)
>
> How would I then capture the value of X for the first five observations
> into an array, the second five values into another array, the third five
> values into a third array, etc. so that I would have 50 arrays of five
> values (or a multidimensional array of size {50,5} containing all of the
> values? I would then send this array to my proc nlp, where it would be used.
>
|