<?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 Re: How to format the variables/columns in this existing SAS dataset in WORK library in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-variables-columns-in-this-existing-SAS-dataset/m-p/507804#M1517</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/239423"&gt;@d6k5d3&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;By the way, I just imported the data. And after importing, it looks like this. I want to make the changes in a data step.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you have an existing SAS data set you can change properties of variables in place with Proc DATASETS. You can rename variables, change formats, informats and labels.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;a brief example creating a copy of a data set you should have:&lt;/P&gt;
&lt;PRE&gt;Data work.class;
   set sashelp.class;
run;
proc datasets lib=work;
   modify class;
      format height f8.4
             weight f12.2
      ;
quit;  &lt;/PRE&gt;
&lt;P&gt;the LIB on the&amp;nbsp; proc statement is the library the dataset(s) you want to modify are in.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Modify statement indicates which dataset you are going to modify.&lt;/P&gt;
&lt;P&gt;The format statement assigns the format to the variable. If you want to have the same format for multiple variables then&lt;/P&gt;
&lt;PRE&gt;proc datasets lib=work;
   modify class;
      format height 
             weight best8.
      ;
quit; &lt;/PRE&gt;
&lt;P&gt;Informat or Label statements work the same. You can have another block of modify statements for another data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The QUIT is used to end the procedure because Datasets is one of the procedures that allows multiple Run groups.&lt;/P&gt;</description>
    <pubDate>Fri, 26 Oct 2018 16:14:47 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-10-26T16:14:47Z</dc:date>
    <item>
      <title>How to format the variables/columns in this existing SAS dataset in WORK library</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-variables-columns-in-this-existing-SAS-dataset/m-p/507639#M1496</link>
      <description>&lt;P&gt;Please have a look at the Dataset which is in Work library. I am working on this Dataset, I need to convert all these values in 12.5 numeric format. These variables are already in numeric format. What code to include after Data yyy; set zzz; ... to make the change? Much thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/24402i4FC6C45A748D4673/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 03:35:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-variables-columns-in-this-existing-SAS-dataset/m-p/507639#M1496</guid>
      <dc:creator>d6k5d3</dc:creator>
      <dc:date>2018-10-26T03:35:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to format the variables/columns in this existing SAS dataset in WORK library</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-variables-columns-in-this-existing-SAS-dataset/m-p/507640#M1497</link>
      <description>&lt;P&gt;please post the data is a SAS datastep.&amp;nbsp; It is hard to read a picture.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 03:41:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-variables-columns-in-this-existing-SAS-dataset/m-p/507640#M1497</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2018-10-26T03:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to format the variables/columns in this existing SAS dataset in WORK library</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-variables-columns-in-this-existing-SAS-dataset/m-p/507642#M1498</link>
      <description>If you just click the picture, you would get the enlarged version.</description>
      <pubDate>Fri, 26 Oct 2018 03:56:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-variables-columns-in-this-existing-SAS-dataset/m-p/507642#M1498</guid>
      <dc:creator>d6k5d3</dc:creator>
      <dc:date>2018-10-26T03:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to format the variables/columns in this existing SAS dataset in WORK library</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-variables-columns-in-this-existing-SAS-dataset/m-p/507643#M1499</link>
      <description>By the way, I just imported the data. And after importing, it looks like this. I want to make the changes in a data step.</description>
      <pubDate>Fri, 26 Oct 2018 03:58:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-variables-columns-in-this-existing-SAS-dataset/m-p/507643#M1499</guid>
      <dc:creator>d6k5d3</dc:creator>
      <dc:date>2018-10-26T03:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to format the variables/columns in this existing SAS dataset in WORK library</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-variables-columns-in-this-existing-SAS-dataset/m-p/507651#M1500</link>
      <description>&lt;P&gt;Must repeat, what &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/122002"&gt;@VDD&lt;/a&gt; already requested: post the data as datastep using datalines-statement, so that we know what type the variables are. There is a huge difference between applying a format and converting data. And to suggest something for the later, we need something to work with. Another option for you: use the search-facility in the community. Converting text to numbers has been explained so many times, that you will, most likely, find adaptable code.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 05:07:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-variables-columns-in-this-existing-SAS-dataset/m-p/507651#M1500</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-10-26T05:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to format the variables/columns in this existing SAS dataset in WORK library</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-variables-columns-in-this-existing-SAS-dataset/m-p/507804#M1517</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/239423"&gt;@d6k5d3&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;By the way, I just imported the data. And after importing, it looks like this. I want to make the changes in a data step.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you have an existing SAS data set you can change properties of variables in place with Proc DATASETS. You can rename variables, change formats, informats and labels.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;a brief example creating a copy of a data set you should have:&lt;/P&gt;
&lt;PRE&gt;Data work.class;
   set sashelp.class;
run;
proc datasets lib=work;
   modify class;
      format height f8.4
             weight f12.2
      ;
quit;  &lt;/PRE&gt;
&lt;P&gt;the LIB on the&amp;nbsp; proc statement is the library the dataset(s) you want to modify are in.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Modify statement indicates which dataset you are going to modify.&lt;/P&gt;
&lt;P&gt;The format statement assigns the format to the variable. If you want to have the same format for multiple variables then&lt;/P&gt;
&lt;PRE&gt;proc datasets lib=work;
   modify class;
      format height 
             weight best8.
      ;
quit; &lt;/PRE&gt;
&lt;P&gt;Informat or Label statements work the same. You can have another block of modify statements for another data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The QUIT is used to end the procedure because Datasets is one of the procedures that allows multiple Run groups.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 16:14:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-variables-columns-in-this-existing-SAS-dataset/m-p/507804#M1517</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-10-26T16:14:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to format the variables/columns in this existing SAS dataset in WORK library</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-variables-columns-in-this-existing-SAS-dataset/m-p/508074#M1593</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;, thank you very much for the reply. I believe your code would work great. But a little change in the plan. I would import the data from a csv file, and all the figures you see would be in CHAR format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So when I would go to modify the dataset, and format the variables to numeric, SAS would give me an error for trying to convert from CHAR to numeric.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What code would you suggest in the format line for conversion from CHAR to numeric?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate your time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Oct 2018 02:15:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-variables-columns-in-this-existing-SAS-dataset/m-p/508074#M1593</guid>
      <dc:creator>d6k5d3</dc:creator>
      <dc:date>2018-10-28T02:15:22Z</dc:date>
    </item>
  </channel>
</rss>

