<?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: Import and set data with variable that is character and numeric in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Import-and-set-data-with-variable-that-is-character-and-numeric/m-p/625737#M184471</link>
    <description>&lt;P&gt;That's how I knew how to import csv files. Each file has the same structure in terms of variable names, but they are defined differently in each of the 12 sets in terms of character or numeric type and need to be converted to numeric before I can merge them all into 1 final set.&lt;/P&gt;</description>
    <pubDate>Wed, 19 Feb 2020 01:19:43 GMT</pubDate>
    <dc:creator>hk19</dc:creator>
    <dc:date>2020-02-19T01:19:43Z</dc:date>
    <item>
      <title>Import and set data with variable that is character and numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-and-set-data-with-variable-that-is-character-and-numeric/m-p/625723#M184464</link>
      <description>&lt;P&gt;Hi! I have an assignment where I need to vertically combine data sets (set, not merge) and they are 12 separate csv files. I have imported the data but 2 variables are listed as both character and numeric variables. Their observations are reported numerically (height and alcohol, reported as number of drinks) so I would like to change both to character variables. I have been trying to complete this operation in the final data step where I combine all 12. I have previously tried creating new variables where I multiply the old variable by 1 and I have included my current code below. All 12 files have been imported without issue, I am now running into problems as I try to merge them. I am also using SAS studio and it says that there are 0 observations, despite there being 528 combined throughout the 12 data sets.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Should I be looking for a solution in my data step or fixing each variable as I import the data? Thank you for your help!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;/*Example of last import, done successfully*/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc import out=D12&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;datafile = '/home/u42933802/CM/DN012.csv'&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;DBMS= csv replace;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;getnames=yes;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;/*Merge all files*/&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;libname CMEA '/home/u42933802/CM';&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;data final_data;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;set D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;orig_var = 'Alcohol';&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Drinks = input(Alcohol,8.);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;drop Alcohol; &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;rename Drinks = Alcohol; &lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;orig_var = 'Height';&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Centimeters = input(Height,8.);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;drop Height; &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;rename Centimeters = Height;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc print data=final_data (obs=528);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="sasError"&gt;&lt;EM&gt;ERROR: Variable Height has been defined as both character and numeric.&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&lt;EM&gt;ERROR: Variable Alcohol has been defined as both character and numeric.&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&lt;EM&gt;ERROR: Variable Alcohol has been defined as both character and numeric.&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&lt;EM&gt;ERROR: Variable Alcohol has been defined as both character and numeric.&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&lt;EM&gt;ERROR: Variable Height has been defined as both character and numeric.&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&lt;EM&gt;ERROR: Variable Alcohol has been defined as both character and numeric.&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&lt;EM&gt;ERROR: Variable Alcohol has been defined as both character and numeric.&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&lt;EM&gt;ERROR: Variable Alcohol has been defined as both character and numeric.&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&lt;EM&gt;ERROR: Variable Alcohol has been defined as both character and numeric.&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&lt;EM&gt;ERROR: Variable Alcohol has been defined as both character and numeric.&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;EM&gt;74&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;EM&gt;75 orig_var = 'Alcohol';&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;EM&gt;76 Drinks = input(Alcohol,8.);&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;EM&gt;77 drop Alcohol;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;EM&gt;78 rename Drinks = Alcohol;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;EM&gt;79&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;EM&gt;80 orig_var = 'Height';&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;EM&gt;81 Centimeters = input(Height,8.);&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;EM&gt;82 drop Height;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;EM&gt;83 rename Centimeters = Height;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;EM&gt;84&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;EM&gt;85 run;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;76:19 81:24&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;&lt;EM&gt;WARNING: The data set WORK.FINAL_DATA may be incomplete. When this step was stopped there were 0 observations and 9 variables.&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;&lt;EM&gt;WARNING: Data set WORK.FINAL_DATA was not replaced because this step was stopped.&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;NOTE: DATA statement used (Total process time):&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;real time 0.00 seconds&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;user cpu time 0.00 seconds&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;system cpu time 0.01 seconds&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;memory 3974.68k&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;OS Memory 36316.00k&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;Timestamp 02/18/2020 10:49:16 PM&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;Step Count 438 Switch Count 0&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;Page Faults 0&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;Page Reclaims 528&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;Page Swaps 0&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;Voluntary Context Switches 0&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;Involuntary Context Switches 0&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;Block Input Operations 0&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;Block Output Operations 16&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;EM&gt;86&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;EM&gt;87 proc print data=final_data (obs=528);&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;EM&gt;88 run;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;NOTE: No observations in data set WORK.FINAL_DATA.&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;real time 0.00 seconds&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;user cpu time 0.00 seconds&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;system cpu time 0.00 seconds&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;memory 740.12k&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;OS Memory 33196.00k&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;Timestamp 02/18/2020 10:49:16 PM&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;Step Count 439 Switch Count 0&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;Page Faults 0&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;Page Reclaims 65&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;Page Swaps 0&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;Voluntary Context Switches 0&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;Involuntary Context Switches 0&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;Block Input Operations 0&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;EM&gt;Block Output Operations 0&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;EM&gt;89&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;EM&gt;90&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;EM&gt;91 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;EM&gt;102&lt;/EM&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 18 Feb 2020 22:50:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-and-set-data-with-variable-that-is-character-and-numeric/m-p/625723#M184464</guid>
      <dc:creator>hk19</dc:creator>
      <dc:date>2020-02-18T22:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: Import and set data with variable that is character and numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-and-set-data-with-variable-that-is-character-and-numeric/m-p/625729#M184467</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&amp;gt;&amp;nbsp; I have been trying to complete this operation in the final data step&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The variables have to be clean when the data sets are merged.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Either change them before, or rename the bad ones as you merge.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;&lt;STRONG&gt;&amp;nbsp; set D1-D4 &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; D5(rename=(HEIGHT=HEIGHT_NUM)) &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; D6-D8 &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; D9(rename=(HEIGHT=HEIGHT_NUM))&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; D10-D12;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and then process them as needed.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2020 23:55:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-and-set-data-with-variable-that-is-character-and-numeric/m-p/625729#M184467</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-02-18T23:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: Import and set data with variable that is character and numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-and-set-data-with-variable-that-is-character-and-numeric/m-p/625734#M184469</link>
      <description>&lt;P&gt;Thank you for your help! I used your suggesting and renamed both variables after importing prior to merging the data sets.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;set D1(rename=(Height=Height_Num Alcohol=Alcohol_Num));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I still got the same error code when I merged the cleaned data together though?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 01:00:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-and-set-data-with-variable-that-is-character-and-numeric/m-p/625734#M184469</guid>
      <dc:creator>hk19</dc:creator>
      <dc:date>2020-02-19T01:00:19Z</dc:date>
    </item>
    <item>
      <title>Re: Import and set data with variable that is character and numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-and-set-data-with-variable-that-is-character-and-numeric/m-p/625735#M184470</link>
      <description>&lt;P&gt;Why did you use PROC IMPORT?&amp;nbsp; That has to guess how to define the variables.&amp;nbsp; Just write your own data steps to read the CSV files.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are the CSV files supposed to have the same structure?&amp;nbsp; If they do you can read all 12 in one data step and eliminate the need for a data step to set them together.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 01:08:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-and-set-data-with-variable-that-is-character-and-numeric/m-p/625735#M184470</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-02-19T01:08:01Z</dc:date>
    </item>
    <item>
      <title>Re: Import and set data with variable that is character and numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-and-set-data-with-variable-that-is-character-and-numeric/m-p/625737#M184471</link>
      <description>&lt;P&gt;That's how I knew how to import csv files. Each file has the same structure in terms of variable names, but they are defined differently in each of the 12 sets in terms of character or numeric type and need to be converted to numeric before I can merge them all into 1 final set.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 01:19:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-and-set-data-with-variable-that-is-character-and-numeric/m-p/625737#M184471</guid>
      <dc:creator>hk19</dc:creator>
      <dc:date>2020-02-19T01:19:43Z</dc:date>
    </item>
    <item>
      <title>Re: Import and set data with variable that is character and numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-and-set-data-with-variable-that-is-character-and-numeric/m-p/625739#M184472</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/312799"&gt;@hk19&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;That's how I knew how to import csv files. Each file has the same structure in terms of variable names, but they are defined differently in each of the 12 sets in terms of character or numeric type and need to be converted to numeric before I can merge them all into 1 final set.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;A CSV file does not have any place where it could define the type of a variable. The only metadata it can have is the (optional) header line that you can use as a hint for what names to use for each column.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 01:21:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-and-set-data-with-variable-that-is-character-and-numeric/m-p/625739#M184472</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-02-19T01:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: Import and set data with variable that is character and numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-and-set-data-with-variable-that-is-character-and-numeric/m-p/625741#M184473</link>
      <description>&lt;P&gt;After downloading the CSV files to SAS studio and running them, I was able to see a table of variables and attributes showing which data sets showed character vs numeric variables. A PROC IMPORT operation was performed in the log by running this in SAS Studio. I am still not sure what other operation I should perform besides the set statement to make sure that I can make 2 variables numeric instead of conflicting, as I reported my error code.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 01:27:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-and-set-data-with-variable-that-is-character-and-numeric/m-p/625741#M184473</guid>
      <dc:creator>hk19</dc:creator>
      <dc:date>2020-02-19T01:27:16Z</dc:date>
    </item>
    <item>
      <title>Re: Import and set data with variable that is character and numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-and-set-data-with-variable-that-is-character-and-numeric/m-p/625748#M184476</link>
      <description>&lt;P&gt;If you still have this error,it means the data is not clean.&lt;/P&gt;
&lt;P&gt;Check that all variables with the same name have the same type (num or char) in all tables, and hopefully the same length too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 01:32:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-and-set-data-with-variable-that-is-character-and-numeric/m-p/625748#M184476</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-02-19T01:32:54Z</dc:date>
    </item>
    <item>
      <title>Re: Import and set data with variable that is character and numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-and-set-data-with-variable-that-is-character-and-numeric/m-p/625750#M184477</link>
      <description>&lt;P&gt;PROC IMPORT will look at a specific CSV file and try to guess how to define the variables based on the set of text values in that one file.&lt;/P&gt;
&lt;P&gt;It will generate data step code that you should see in the log.&amp;nbsp; You could start with that as a model for the code you need to create.&lt;/P&gt;
&lt;P&gt;But it is really easy to write the code to read a CSV from scratch without using PROC IMPORT at all.&lt;/P&gt;
&lt;P&gt;Basic structure is like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  infile 'myfile.txt' dsd firstobs=2 truncover;
  length firstvar 8 var2 $30 var3 8 lastvar $40;
  input firstvar -- lastvar;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The DATA statement names the dataset you want to create. The INFILE statement tells SAS where to find the lines of text and that you want to treat it as delimited and skip the header line.&amp;nbsp; If your file is not a&amp;nbsp; true CSV file, but some other type of delimited then you can use the DLM= option on the INFILE statement to tell it what character(s) to treat as the delimiter.&amp;nbsp; The LENGTH statement defines the type of the variables (and for character variables the length). Note for numeric variables just use 8 since SAS stores all numbers as 8 byte floating point values.&amp;nbsp; Then INPUT statement tells it which variables to read. You can abbreviate it by using a positional variable list like in this example.&lt;/P&gt;
&lt;P&gt;If you have DATE, TIME or DATETIME values (or possibly other things like numbers with commas or $ in them) then you can add a INFORMAT statement to tell SAS how to convert the text in the file into the right numbers.&amp;nbsp; For DATE, TIME and DATETIME values you will want to attach an appropriate FORMAT so they print in a human readable style.&amp;nbsp; The format you choose does not have to match how it was stored as text in the source file. It just needs to be appropriate for the values.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 01:34:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-and-set-data-with-variable-that-is-character-and-numeric/m-p/625750#M184477</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-02-19T01:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: Import and set data with variable that is character and numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-and-set-data-with-variable-that-is-character-and-numeric/m-p/625751#M184478</link>
      <description>&lt;P&gt;1. You can use proc contents to see the variable types.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. When you run proc import, you can see the data step that's generated displayed in the log.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use and alter that code to import the data exactly as intended in a consistent manner for all tables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 01:36:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-and-set-data-with-variable-that-is-character-and-numeric/m-p/625751#M184478</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-02-19T01:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: Import and set data with variable that is character and numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-and-set-data-with-variable-that-is-character-and-numeric/m-p/625753#M184480</link>
      <description>&lt;P&gt;Thank you so much for your help, I never learned how to do this before and this ended up working. Thank you for teaching me!&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 02:10:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-and-set-data-with-variable-that-is-character-and-numeric/m-p/625753#M184480</guid>
      <dc:creator>hk19</dc:creator>
      <dc:date>2020-02-19T02:10:08Z</dc:date>
    </item>
  </channel>
</rss>

