<?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: Amend Formating in table in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Amend-Formating-in-table/m-p/393202#M25356</link>
    <description>&lt;P&gt;I'm not aware of a task-based method to change SAS dataset attributes in EG. However, there are two easy mechanisms to do so:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Create a new query using the query builder, and change the formats on the "Select Data" pane.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. The "Datasets" procedure makes it very easy to change attributes. For example, I took a copy of "sashelp.shoes" into "work.shoes", and used this code to change some attributes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc datasets lib=work nolist;&lt;BR /&gt;modify shoes;&lt;BR /&gt;attrib sales format=best15.;&lt;BR /&gt;attrib inventory informat=best15.;&lt;BR /&gt;attrib returns label='new label';&lt;BR /&gt;quit;&lt;/P&gt;</description>
    <pubDate>Tue, 05 Sep 2017 13:18:40 GMT</pubDate>
    <dc:creator>TomKari</dc:creator>
    <dc:date>2017-09-05T13:18:40Z</dc:date>
    <item>
      <title>Amend Formating in table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Amend-Formating-in-table/m-p/393158#M25354</link>
      <description>&lt;P&gt;Hi your help in this matter would be much appreciated, I am using&amp;nbsp;SAS Enterprise Guide 7.1 and&amp;nbsp;I have taken over someones process.&amp;nbsp;They&amp;nbsp;previously used to import an external CSV file into SAS below is the code&amp;nbsp;previously used. I have also taken a screenshot of the formats etc of the table it goes into&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="RecProperties.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/14820i7C9134397BAF1877/image-size/large?v=v2&amp;amp;px=999" role="button" title="RecProperties.PNG" alt="RecProperties.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;DATA recs.recs;

    LENGTH
        INV_NUMBER         8
		INV_BILLING_PERIOD_YEAR   8
        INV_BILLING_PERIOD_MONTH   8
		NMR_METER_POINT_REFERENCE   8
		RCH_RECONCILIATION_QTY   8
		LDZ_IDENTIFIER   $ 15
		RVE_START_DATE     8
		RVE_END_DATE       8
		NMR_START_METER_READ_DATE   8
        NMR_END_METER_READ_DATE   8;

	FORMAT
        INV_NUMBER       BEST32.
        INV_BILLING_PERIOD_YEAR BEST32.
        INV_BILLING_PERIOD_MONTH BEST32.
        NMR_METER_POINT_REFERENCE BEST32.
        RCH_RECONCILIATION_QTY BEST32.
        LDZ_IDENTIFIER   $CHAR15.
        RVE_START_DATE   YYMMDD10.
        RVE_END_DATE     YYMMDD10.
        NMR_START_METER_READ_DATE YYMMDD10.
        NMR_END_METER_READ_DATE YYMMDD10. ;

INFORMAT
        INV_NUMBER       BEST32.
        INV_BILLING_PERIOD_YEAR BEST32.
        INV_BILLING_PERIOD_MONTH BEST32.
        NMR_METER_POINT_REFERENCE BEST32.
        RCH_RECONCILIATION_QTY BEST32.
        LDZ_IDENTIFIER   $CHAR15.
        RVE_START_DATE   YYMMDD10.
        RVE_END_DATE     YYMMDD10.
        NMR_START_METER_READ_DATE YYMMDD10.
        NMR_END_METER_READ_DATE YYMMDD10. ;
    
 
Infile "Drop/LSPRec_201706.csv"
LRECL=1029
        TERMSTR=CRLF
        truncover
        firstobs=3
		obs=60000;
    INPUT
       
        @1 INV_NUMBER       : ?? BEST6.
		@41 INV_BILLING_PERIOD_YEAR : ?? BEST4.
        @81 INV_BILLING_PERIOD_MONTH : ?? BEST2.
		@121 NMR_METER_POINT_REFERENCE : ?? BEST10.
		@161 RCH_RECONCILIATION_QTY : ?? BEST8.
		@201 LDZ_IDENTIFIER   : $CHAR2.
		@216 RVE_START_DATE   : ?? YYMMDD10.
		@231 RVE_END_DATE     : ?? YYMMDD10.
		@244 NMR_START_METER_READ_DATE : ?? YYMMDD10.
        @270 NMR_END_METER_READ_DATE : ?? YYMMDD10.;
	
RUN;

/*check that you have imported in the same amount that is in the CSV file*/

proc append base=rich_dat.recs data=recs.recs;
run;&lt;/PRE&gt;&lt;P&gt;The Data set is much bigger now over 1.5 million rows and someone dumps the data into a a table, all the column names are the same but the Formats and lengths are different. I have added a screenshot below of the lengths and Formats.&amp;nbsp;I would like the formats to be the same as the above. How do i go about changing the formats lengths etc?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2017 11:22:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Amend-Formating-in-table/m-p/393158#M25354</guid>
      <dc:creator>zdassu</dc:creator>
      <dc:date>2017-09-05T11:22:30Z</dc:date>
    </item>
    <item>
      <title>Re: Amend Formating in table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Amend-Formating-in-table/m-p/393160#M25355</link>
      <description>&lt;P&gt;My Apologies I forgot to add the screenshot of the table with the data that needs formatting&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IncorrectTableProperties.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/14821i0EFBBFE5E5786BE3/image-size/large?v=v2&amp;amp;px=999" role="button" title="IncorrectTableProperties.PNG" alt="IncorrectTableProperties.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2017 11:28:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Amend-Formating-in-table/m-p/393160#M25355</guid>
      <dc:creator>zdassu</dc:creator>
      <dc:date>2017-09-05T11:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: Amend Formating in table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Amend-Formating-in-table/m-p/393202#M25356</link>
      <description>&lt;P&gt;I'm not aware of a task-based method to change SAS dataset attributes in EG. However, there are two easy mechanisms to do so:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Create a new query using the query builder, and change the formats on the "Select Data" pane.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. The "Datasets" procedure makes it very easy to change attributes. For example, I took a copy of "sashelp.shoes" into "work.shoes", and used this code to change some attributes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc datasets lib=work nolist;&lt;BR /&gt;modify shoes;&lt;BR /&gt;attrib sales format=best15.;&lt;BR /&gt;attrib inventory informat=best15.;&lt;BR /&gt;attrib returns label='new label';&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2017 13:18:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Amend-Formating-in-table/m-p/393202#M25356</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2017-09-05T13:18:40Z</dc:date>
    </item>
    <item>
      <title>Re: Amend Formating in table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Amend-Formating-in-table/m-p/393220#M25358</link>
      <description>&lt;P&gt;Hi how would i amend the data type from charachter to numeric, as the data type is currently charachter it does not let me use the format best&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2017 13:59:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Amend-Formating-in-table/m-p/393220#M25358</guid>
      <dc:creator>zdassu</dc:creator>
      <dc:date>2017-09-05T13:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: Amend Formating in table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Amend-Formating-in-table/m-p/393240#M25361</link>
      <description>&lt;P&gt;Oh, now THAT's a different topic!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can't change the data type of a variable "in place", which isn't surprising.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to use a task, you can use the Query Builder, create a new advanced expression, and transform the variable using the "input" function. If you want to convert "problem_var", the expression&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;input(problem_var, best15.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;will almost certainly do the job, but make sure you do a good job of testing!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2017 14:38:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Amend-Formating-in-table/m-p/393240#M25361</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2017-09-05T14:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: Amend Formating in table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Amend-Formating-in-table/m-p/393285#M25367</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/59173"&gt;@zdassu&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi your help in this matter would be much appreciated, I am using&amp;nbsp;SAS Enterprise Guide 7.1 and&amp;nbsp;I have taken over someones process.&amp;nbsp;They&amp;nbsp;previously used to import an external CSV file into SAS below is the code&amp;nbsp;previously used. I have also taken a screenshot of the formats etc of the table it goes into&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Data set is much bigger now over 1.5 million rows and someone dumps the data into a a table, all the column names are the same but the Formats and lengths are different. I have added a screenshot below of the lengths and Formats.&amp;nbsp;I would like the formats to be the same as the above. How do i go about changing the formats lengths etc?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;One thing to ask management would be if there is an agreement as to the file layout changing and is this new format "stable", as in not going to change frequently.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will say that variables with names like Month or Year with 40 columns sounds very strange. In fact seeing 40 replicated so many places makes me think of some database default length and possibly type that wasn't considered very much. And with CSV I would look at the data file in a text editor (NOT a spreadsheet) to verify that the values are actually occupying close to 40 columns. If not, and especially if you see values like 1 to 12 in the Inv_Billing_Period_Month, I might strongly keep the current variable type,informat and format. I would check an example file for every one of those $40 fields.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Rch_Reconciliation_Qty is another very suspicious character variable as QTY makes me believe this is a Quantity and if so really should be numeric.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And an aside, just because an INFORMAT changes doesn't mean that you have to change the FORMAT. I get dates in a number of formats and display them all in the display format I prefer (or organization policy sets).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2017 16:11:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Amend-Formating-in-table/m-p/393285#M25367</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-09-05T16:11:03Z</dc:date>
    </item>
    <item>
      <title>Re: Amend Formating in table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Amend-Formating-in-table/m-p/393345#M25368</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me make sure I understand the question.&lt;/P&gt;
&lt;P&gt;It sounds like that instead of running the data step you posted to create a dataset from a CSV file you are now being given a SAS dataset. &amp;nbsp;And your question is how to transform that dataset to look like the data you used to read from the CSV file so that the rest of the code in the process doesn't need to change.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2017 19:42:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Amend-Formating-in-table/m-p/393345#M25368</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-09-05T19:42:36Z</dc:date>
    </item>
    <item>
      <title>Re: Amend Formating in table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Amend-Formating-in-table/m-p/393346#M25369</link>
      <description>&lt;P&gt;Pictures of the variable names and formats are nice, but not very useful for writing code. Can't you just copy and paste the output of PROC CONTENTS so that we have the variable names and formats as text instead of graphics?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2017 19:43:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Amend-Formating-in-table/m-p/393346#M25369</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-09-05T19:43:52Z</dc:date>
    </item>
    <item>
      <title>Re: Amend Formating in table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Amend-Formating-in-table/m-p/393497#M25372</link>
      <description>&lt;P&gt;I have used the following code and it has actually completed what i wanted to achieve.&lt;/P&gt;&lt;P&gt;Thanks everyone for your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PROC SQL;
   CREATE TABLE Work.Test AS 
   SELECT /* INV_NUMBER */
            (INPUT(t1.INV_NUMBER, best32.))format=best32. informat=best32. LENGTH=8 LABEL="INV_NUMBER" AS INV_NUMBER, 
          /* INV_BILLING_PERIOD_YEAR */
            (INPUT(t1.INV_BILLING_PERIOD_YEAR, best32.)) format=best32. informat=best32. LENGTH=8 LABEL="INV_BILLING_PERIOD_YEAR" AS 
            INV_BILLING_PERIOD_YEAR, 
          /* INV_BILLING_PERIOD_MONTH */
            (INPUT(t1.INV_BILLING_PERIOD_MONTH, best32.)) format=best32. informat=best32. LENGTH=8 LABEL="INV_BILLING_PERIOD_MONTH" AS 
            INV_BILLING_PERIOD_MONTH, 
          /* NMR_METER_POINT_REFERENCE */
            (INPUT(t1.NMR_METER_POINT_REFERENCE, best32.)) format=best32. informat=best32. LENGTH=8 LABEL="NMR_METER_POINT_REFERENCE" AS 
            NMR_METER_POINT_REFERENCE, 
          /* RCH_RECONCILIATION_QTY */
            (INPUT(t1.RCH_RECONCILIATION_QTY, Best32.)) format=best32. informat=best32. LENGTH=8 LABEL="RCH_RECONCILIATION_QTY" AS 
            RCH_RECONCILIATION_QTY, 
          /* LDZ_IDENTIFIER */
            (t1.LDZ_IDENTIFIER) FORMAT=$CHAR15. informat=$CHAR15. LENGTH=15 LABEL="LDZ_IDENTIFIER" AS LDZ_IDENTIFIER, 
          /* RVE_START_DATE */
            (t1.RVE_START_DATE) FORMAT=YYMMDD10. informat=YYMMDD10. LENGTH=8 LABEL="RVE_START_DATE" AS RVE_START_DATE, 
          /* RVE_END_DATE */
            (t1.RVE_END_DATE) FORMAT=YYMMDD10. informat=YYMMDD10. LENGTH=8 LABEL="RVE_END_DATE" AS RVE_END_DATE, 
          /* NMR_END_METER_READ_DATE */
            (t1.NMR_END_METER_READ_DATE) FORMAT=YYMMDD10. informat=YYMMDD10. LENGTH=8 LABEL="NMR_END_METER_READ_DATE" AS 
            NMR_END_METER_READ_DATE, 
          /* NMR_START_METER_READ_DATE */
            (t1.NMR_START_METER_READ_DATE) FORMAT=YYMMDD10. informat=YYMMDD10. LENGTH=8 LABEL="NMR_START_METER_READ_DATE" AS 
            NMR_START_METER_READ_DATE
      FROM Work.Test1;
QUIT;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Sep 2017 10:17:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Amend-Formating-in-table/m-p/393497#M25372</guid>
      <dc:creator>zdassu</dc:creator>
      <dc:date>2017-09-06T10:17:58Z</dc:date>
    </item>
  </channel>
</rss>

