<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Create SAS Dataset from vectors and matrix in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Create-SAS-Dataset-from-vectors-and-matrix/m-p/190901#M1960</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;From the helpful post: &lt;A href="http://blogs.sas.com/content/iml/2011/04/18/writing-data-from-a-matrix-to-a-sas-data-set/" title="http://blogs.sas.com/content/iml/2011/04/18/writing-data-from-a-matrix-to-a-sas-data-set/"&gt; Writing data from a matrix to a SAS data set - The DO Loop&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It shows to make a dataset from vectors with the var statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc iml;&lt;/P&gt;&lt;P&gt;/** create SAS data set from vectors **/&lt;/P&gt;&lt;P&gt;y = {1,0,3,2,0,3}; /** 6 x 1 vector **/&lt;/P&gt;&lt;P&gt;z = {8,7,6,5,6}; /** 5 x 1 vector **/&lt;/P&gt;&lt;P&gt;c = {A A A B B B}; /** 1 x 6 character vector **/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create MyData var {y z c}; /** create data set **/&lt;/P&gt;&lt;P&gt;append; /** write data in vectors **/&lt;/P&gt;&lt;P&gt;close MyData; /** close the data set **/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And from a matrix with the from statement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc iml;&lt;/P&gt;&lt;P&gt;/** create SAS data set from a matrix **/&lt;/P&gt;&lt;P&gt;x = {1 2 3,&lt;/P&gt;&lt;P&gt;&amp;nbsp; 4 5 6,&lt;/P&gt;&lt;P&gt;&amp;nbsp; 7 8 9,&lt;/P&gt;&lt;P&gt;&amp;nbsp; 3 2 1 }; /** 4 x 3 matrix **/&lt;/P&gt;&lt;P&gt;create MyData2 from x[colname={"q" "r" "s"}];&lt;/P&gt;&lt;P&gt;append from x;&lt;/P&gt;&lt;P&gt;close MyData2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Say I have 2 vectors with dimensions, 5x1, and a matrix size 5 x 5.&amp;nbsp; What is the best way combine or just utilize one of these approaches to get a SAS dataset with 5 records and 7 columns? Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Jan 2015 18:22:58 GMT</pubDate>
    <dc:creator>kellyhobson</dc:creator>
    <dc:date>2015-01-20T18:22:58Z</dc:date>
    <item>
      <title>Create SAS Dataset from vectors and matrix</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Create-SAS-Dataset-from-vectors-and-matrix/m-p/190901#M1960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;From the helpful post: &lt;A href="http://blogs.sas.com/content/iml/2011/04/18/writing-data-from-a-matrix-to-a-sas-data-set/" title="http://blogs.sas.com/content/iml/2011/04/18/writing-data-from-a-matrix-to-a-sas-data-set/"&gt; Writing data from a matrix to a SAS data set - The DO Loop&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It shows to make a dataset from vectors with the var statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc iml;&lt;/P&gt;&lt;P&gt;/** create SAS data set from vectors **/&lt;/P&gt;&lt;P&gt;y = {1,0,3,2,0,3}; /** 6 x 1 vector **/&lt;/P&gt;&lt;P&gt;z = {8,7,6,5,6}; /** 5 x 1 vector **/&lt;/P&gt;&lt;P&gt;c = {A A A B B B}; /** 1 x 6 character vector **/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create MyData var {y z c}; /** create data set **/&lt;/P&gt;&lt;P&gt;append; /** write data in vectors **/&lt;/P&gt;&lt;P&gt;close MyData; /** close the data set **/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And from a matrix with the from statement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc iml;&lt;/P&gt;&lt;P&gt;/** create SAS data set from a matrix **/&lt;/P&gt;&lt;P&gt;x = {1 2 3,&lt;/P&gt;&lt;P&gt;&amp;nbsp; 4 5 6,&lt;/P&gt;&lt;P&gt;&amp;nbsp; 7 8 9,&lt;/P&gt;&lt;P&gt;&amp;nbsp; 3 2 1 }; /** 4 x 3 matrix **/&lt;/P&gt;&lt;P&gt;create MyData2 from x[colname={"q" "r" "s"}];&lt;/P&gt;&lt;P&gt;append from x;&lt;/P&gt;&lt;P&gt;close MyData2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Say I have 2 vectors with dimensions, 5x1, and a matrix size 5 x 5.&amp;nbsp; What is the best way combine or just utilize one of these approaches to get a SAS dataset with 5 records and 7 columns? Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Jan 2015 18:22:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Create-SAS-Dataset-from-vectors-and-matrix/m-p/190901#M1960</guid>
      <dc:creator>kellyhobson</dc:creator>
      <dc:date>2015-01-20T18:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: Create SAS Dataset from vectors and matrix</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Create-SAS-Dataset-from-vectors-and-matrix/m-p/190902#M1961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If they are all the same data type (all numeric or all character), I would use concatenation:&lt;BR /&gt;x = {1,2,3,4,5};&lt;/P&gt;&lt;P&gt;y = {5,4,3,2,1};&lt;/P&gt;&lt;P&gt;z = shape(1:25, 5);&lt;/P&gt;&lt;P&gt;m = x || y || z;&lt;/P&gt;&lt;P&gt;create MyData from m;&lt;/P&gt;&lt;P&gt;append from m;&lt;/P&gt;&lt;P&gt;close;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Jan 2015 18:44:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Create-SAS-Dataset-from-vectors-and-matrix/m-p/190902#M1961</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2015-01-20T18:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: Create SAS Dataset from vectors and matrix</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Create-SAS-Dataset-from-vectors-and-matrix/m-p/190903#M1962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Rick!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Jan 2015 18:52:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Create-SAS-Dataset-from-vectors-and-matrix/m-p/190903#M1962</guid>
      <dc:creator>kellyhobson</dc:creator>
      <dc:date>2015-01-20T18:52:39Z</dc:date>
    </item>
  </channel>
</rss>

