<?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 Data format question in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Data-format-question/m-p/58597#M12711</link>
    <description>Hi, I am facing a problem when i use SAS 9.2 version.&lt;BR /&gt;
&lt;BR /&gt;
I have imported some excel 2007 file (.xlsx file) to the SAS lib. The data in the excel 2007 are all in the same format.&lt;BR /&gt;
&lt;BR /&gt;
When i try to use &lt;BR /&gt;
DATA ...&lt;BR /&gt;
SET  FILE1 FILE2&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
It tells me error because of one variable in these two file has different format.&lt;BR /&gt;
&lt;BR /&gt;
I check them in the SAS lib file. the same variable, say, varible MTM are in different format in the two files.&lt;BR /&gt;
&lt;BR /&gt;
one is numerical, the other is character.&lt;BR /&gt;
&lt;BR /&gt;
How come? as they have the same format in excel. After they are imported to SAS, it becomes different. This makes me fail to combine the files. (files have too many rows, which can not combine them in excel....).&lt;BR /&gt;
&lt;BR /&gt;
If anyone understand what i am asking, would you kindly tell me how can i solve it?</description>
    <pubDate>Fri, 24 Jul 2009 07:18:50 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-07-24T07:18:50Z</dc:date>
    <item>
      <title>Data format question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-format-question/m-p/58597#M12711</link>
      <description>Hi, I am facing a problem when i use SAS 9.2 version.&lt;BR /&gt;
&lt;BR /&gt;
I have imported some excel 2007 file (.xlsx file) to the SAS lib. The data in the excel 2007 are all in the same format.&lt;BR /&gt;
&lt;BR /&gt;
When i try to use &lt;BR /&gt;
DATA ...&lt;BR /&gt;
SET  FILE1 FILE2&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
It tells me error because of one variable in these two file has different format.&lt;BR /&gt;
&lt;BR /&gt;
I check them in the SAS lib file. the same variable, say, varible MTM are in different format in the two files.&lt;BR /&gt;
&lt;BR /&gt;
one is numerical, the other is character.&lt;BR /&gt;
&lt;BR /&gt;
How come? as they have the same format in excel. After they are imported to SAS, it becomes different. This makes me fail to combine the files. (files have too many rows, which can not combine them in excel....).&lt;BR /&gt;
&lt;BR /&gt;
If anyone understand what i am asking, would you kindly tell me how can i solve it?</description>
      <pubDate>Fri, 24 Jul 2009 07:18:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-format-question/m-p/58597#M12711</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-07-24T07:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: Data format question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-format-question/m-p/58598#M12712</link>
      <description>Hi!&lt;BR /&gt;
&lt;BR /&gt;
You can convert variable MTM to numeric with function input() or to text with function put().&lt;BR /&gt;
&lt;BR /&gt;
For example;&lt;BR /&gt;
&lt;BR /&gt;
data file1; set file1;&lt;BR /&gt;
mtm1=input(mtm,8.);  drop mtm; rename mtm1=mtm; run;&lt;BR /&gt;
&lt;BR /&gt;
then use your code&lt;BR /&gt;
&lt;BR /&gt;
data ...&lt;BR /&gt;
set file1 file2</description>
      <pubDate>Fri, 24 Jul 2009 07:50:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-format-question/m-p/58598#M12712</guid>
      <dc:creator>Oleg_L</dc:creator>
      <dc:date>2009-07-24T07:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: Data format question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-format-question/m-p/58599#M12713</link>
      <description>Thank you so much.&lt;BR /&gt;
&lt;BR /&gt;
forget to bring my laptop today.:)&lt;BR /&gt;
&lt;BR /&gt;
I will back home to try your method later on. I am thinking to convert the format, but i did not know how to. A new user, kinda.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
i would tell u whether it works or not.:)</description>
      <pubDate>Fri, 24 Jul 2009 07:58:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-format-question/m-p/58599#M12713</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-07-24T07:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: Data format question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-format-question/m-p/58600#M12714</link>
      <description>Lucilla,&lt;BR /&gt;
you should remember about informat using the input function and format using put function.&lt;BR /&gt;
If you want to convert text variable MTM to numeric and text looks like "111,233,654" then you should use the following informat to function input:&lt;BR /&gt;
mtm1=input(mtm,comma17.);&lt;BR /&gt;
See your data before proceeding.</description>
      <pubDate>Fri, 24 Jul 2009 08:32:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-format-question/m-p/58600#M12714</guid>
      <dc:creator>Oleg_L</dc:creator>
      <dc:date>2009-07-24T08:32:49Z</dc:date>
    </item>
    <item>
      <title>Re: Data format question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-format-question/m-p/58601#M12715</link>
      <description>too bad....&lt;BR /&gt;
&lt;BR /&gt;
i cannot even open the file... as it is too big files..&lt;BR /&gt;
&lt;BR /&gt;
it said "ERROR: (8) Not enough storage is available to process this command.  [SASZAF  ]&lt;BR /&gt;
ERROR: (8) Not enough storage is available to process this command.  [ViewTabl]&lt;BR /&gt;
ERROR: Out of memory.&lt;BR /&gt;
."&lt;BR /&gt;
&lt;BR /&gt;
I have already clean up my disk. and leave about 10 g for each space... it is still not able to open.</description>
      <pubDate>Sat, 25 Jul 2009 05:04:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-format-question/m-p/58601#M12715</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-07-25T05:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: Data format question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-format-question/m-p/58602#M12716</link>
      <description>&amp;gt; Lucilla,&lt;BR /&gt;
&amp;gt; you should remember about informat using the input&lt;BR /&gt;
&amp;gt; function and format using put function.&lt;BR /&gt;
&amp;gt; If you want to convert text variable MTM to numeric&lt;BR /&gt;
&amp;gt; and text looks like "111,233,654" then you should use&lt;BR /&gt;
&amp;gt; the following informat to function input:&lt;BR /&gt;
&amp;gt; mtm1=input(mtm,comma17.);&lt;BR /&gt;
&amp;gt; See your data before proceeding.&lt;BR /&gt;
&lt;BR /&gt;
Hi, forget about the memory problem. let us just focus on the data format first.&lt;BR /&gt;
&lt;BR /&gt;
i use a small file.:)&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
i check the MTM's attribute.&lt;BR /&gt;
&lt;BR /&gt;
it is  for one file:&lt;BR /&gt;
&lt;BR /&gt;
"&lt;BR /&gt;
&lt;BR /&gt;
length : 8&lt;BR /&gt;
format: best12&lt;BR /&gt;
informat: 12&lt;BR /&gt;
&lt;BR /&gt;
Type:  numeric   (one the right side as default) &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
For the other it is&lt;BR /&gt;
&lt;BR /&gt;
length: 4&lt;BR /&gt;
format:$4&lt;BR /&gt;
informat:$4&lt;BR /&gt;
 type: character</description>
      <pubDate>Sat, 25 Jul 2009 08:50:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-format-question/m-p/58602#M12716</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-07-25T08:50:40Z</dc:date>
    </item>
    <item>
      <title>Re: Data format question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-format-question/m-p/58603#M12717</link>
      <description>Lucilla,&lt;BR /&gt;
&lt;BR /&gt;
You may be able to go back to the original Excel sheets and fix the problem there.&lt;BR /&gt;
&lt;BR /&gt;
Depending on how you brought the data in, SAS looks at the applied Excel format and/or the first &lt;X&gt; rows (&lt;X&gt; can be changed, I think the default is 50).  &lt;BR /&gt;
&lt;BR /&gt;
If you think that column should really be numeric, look at your excel sheet that is character.  Change the format to display as a number.  Scan down through the data.  Are there garbage characters that could come out.  You may need to do some basic data cleaning.&lt;BR /&gt;
&lt;BR /&gt;
I'm not sure how you are set up, but I am using SAS 9.2 and EGuide 4.2 and the new version of EGuide does a really good job of bringing in data from excel and .csv files; I'm not sure what they changed, but it "feels" more robust.&lt;BR /&gt;
&lt;BR /&gt;
Doc Muhlbaier&lt;BR /&gt;
Duke&lt;/X&gt;&lt;/X&gt;</description>
      <pubDate>Sun, 26 Jul 2009 14:34:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-format-question/m-p/58603#M12717</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2009-07-26T14:34:31Z</dc:date>
    </item>
    <item>
      <title>Re: Data format question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-format-question/m-p/58604#M12718</link>
      <description>Hi, I use put to &lt;BR /&gt;
&lt;BR /&gt;
such as :&lt;BR /&gt;
"data Liutwo.Dealissueyear2006alta;&lt;BR /&gt;
set Liutwo.Dealissueyear2006alta;&lt;BR /&gt;
MTM1=put(MTM,12.);&lt;BR /&gt;
SCORE1=put(SCORE,12.);&lt;BR /&gt;
DROP MTM SCORE;&lt;BR /&gt;
&lt;BR /&gt;
run;"&lt;BR /&gt;
&lt;BR /&gt;
and they are tranformed to Character format, and then i can combine the files together as they are the same format after the transforming.&lt;BR /&gt;
&lt;BR /&gt;
But if i use input.. it shows error...  (Probaly because, there are a lot of missing data coded as "N/A" in excel)&lt;BR /&gt;
&lt;BR /&gt;
BTW: can i convert the character to numericals after i combine all the files. &lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; Lucilla,&lt;BR /&gt;
&amp;gt; you should remember about informat using the input&lt;BR /&gt;
&amp;gt; function and format using put function.&lt;BR /&gt;
&amp;gt; If you want to convert text variable MTM to numeric&lt;BR /&gt;
&amp;gt; and text looks like "111,233,654" then you should use&lt;BR /&gt;
&amp;gt; the following informat to function input:&lt;BR /&gt;
&amp;gt; mtm1=input(mtm,comma17.);&lt;BR /&gt;
&amp;gt; See your data before proceeding.</description>
      <pubDate>Thu, 30 Jul 2009 03:24:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-format-question/m-p/58604#M12718</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-07-30T03:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: Data format question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-format-question/m-p/58605#M12719</link>
      <description>Thanks. Yes, i tried that method.&lt;BR /&gt;
&lt;BR /&gt;
They are in general format when it is in excel.&lt;BR /&gt;
When i have changed to numerical in excel, it still does not work. Probaly because they are some "N/A" and some are just numbers.&lt;BR /&gt;
&lt;BR /&gt;
I sucessfully combined them after using what Oleg_1976 suggested to converting them into the same format using " put". But problems come as later analysis requires numerical format.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
What is Eguide? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; Lucilla,&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; You may be able to go back to the original Excel&lt;BR /&gt;
&amp;gt; sheets and fix the problem there.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Depending on how you brought the data in, SAS looks&lt;BR /&gt;
&amp;gt; at the applied Excel format and/or the first &lt;X&gt; rows&lt;BR /&gt;
&amp;gt; (&lt;X&gt; can be changed, I think the default is 50).  &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; If you think that column should really be numeric,&lt;BR /&gt;
&amp;gt; look at your excel sheet that is character.  Change&lt;BR /&gt;
&amp;gt; the format to display as a number.  Scan down through&lt;BR /&gt;
&amp;gt; the data.  Are there garbage characters that could&lt;BR /&gt;
&amp;gt; come out.  You may need to do some basic data&lt;BR /&gt;
&amp;gt; cleaning.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; I'm not sure how you are set up, but I am using SAS&lt;BR /&gt;
&amp;gt; 9.2 and EGuide 4.2 and the new version of EGuide does&lt;BR /&gt;
&amp;gt; a really good job of bringing in data from excel and&lt;BR /&gt;
&amp;gt; .csv files; I'm not sure what they changed, but it&lt;BR /&gt;
&amp;gt; "feels" more robust.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Doc Muhlbaier&lt;BR /&gt;
&amp;gt; Duke&lt;/X&gt;&lt;/X&gt;</description>
      <pubDate>Thu, 30 Jul 2009 03:28:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-format-question/m-p/58605#M12719</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-07-30T03:28:13Z</dc:date>
    </item>
    <item>
      <title>Re: Data format question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-format-question/m-p/58606#M12720</link>
      <description>hi, I solved the problem, with using "put" first.&lt;BR /&gt;
&lt;BR /&gt;
after importing them all. I then use some thing like.&lt;BR /&gt;
MTM1=MTM+0;&lt;BR /&gt;
&lt;BR /&gt;
to convert them all back to numerical format.&lt;BR /&gt;
&lt;BR /&gt;
Thank you so much for all the way helping me.</description>
      <pubDate>Sun, 02 Aug 2009 08:48:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-format-question/m-p/58606#M12720</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-08-02T08:48:21Z</dc:date>
    </item>
  </channel>
</rss>

