<?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: Provided Headers vs. Provided Dataset without Headers in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234512#M5918</link>
    <description>&lt;P&gt;Hi, I think I am almost there, you were correct in that I ment I had a SAS dataset in my WORK&amp;nbsp;library.&lt;/P&gt;
&lt;P&gt;I have two datasets, both I've read into SAS as SAS datasets within my WORK library.&lt;/P&gt;
&lt;P&gt;&amp;lt;&amp;gt; Dataset_1 = &lt;STRONG&gt;Work.Headerfile&lt;/STRONG&gt;, with one variable "Name Convention" which is a list of my headers.&lt;/P&gt;
&lt;P&gt;&amp;lt;&amp;gt; Dataset_2 = &lt;STRONG&gt;Work.Set_1&lt;/STRONG&gt;, with 900+ variables and 1.2 million rows. Each variable data is under a header F"n", or F1, F2, F3, etc. out to F900.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the alteration to the code: This ran, I'm working to see if it did what I wished.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;filename rename temp;&lt;BR /&gt;data _null_;&lt;BR /&gt;Set HEADER_FILE end=eof;&lt;BR /&gt;length oldname Name_Convention $32;&lt;BR /&gt;oldname = cats('F',_n_);&lt;BR /&gt;file rename;&lt;BR /&gt;if _n_ = 1 THEN PUT Name_Convention;&lt;BR /&gt;put oldname=Name_Convention;&lt;BR /&gt;if eof then put ';';&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;While it seemed to run and if I replaced _null_ with the an output table name, the resulting data looked correct... (two variables, one with my desired header names, the other with variable "oldname" looking like F1 - F900... I then proceeded with&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATA fixed;&lt;BR /&gt; set Set_1;&lt;BR /&gt;%include rename ;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It ran, but did not complete came up with&amp;nbsp;&lt;STRONG&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;I the length of "Name Convention" is also already set so I am unable to apply format $32.&lt;/P&gt;</description>
    <pubDate>Thu, 12 Nov 2015 22:08:21 GMT</pubDate>
    <dc:creator>GalacticAbacus</dc:creator>
    <dc:date>2015-11-12T22:08:21Z</dc:date>
    <item>
      <title>Provided Headers vs. Provided Dataset without Headers</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234232#M5898</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Background:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;I have a data set without headers (we'll call it "Why"). This dataset has 900+ variable columns. I unziped, and convereted the file to a .txt and successfully imported this data set into SAS EG.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I then have a .txt file with 900+ headers (we'll call it "Useful"), containing values to be associated with the large "Why" data set variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Both files (Why, with 900 variable columns and about and 1.3 million&amp;nbsp;rows), and (Useful, with 900 columns and 1 row), have been imported into SAS and are sitting as SAS files within my Work.directory.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Question:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;What is the best way to attach the "Useful" file headers to the "Why" file without headers to the appropriate column?&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Why are headers not attached to datasets?&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;TS&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2015 17:26:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234232#M5898</guid>
      <dc:creator>GalacticAbacus</dc:creator>
      <dc:date>2015-11-11T17:26:34Z</dc:date>
    </item>
    <item>
      <title>Re: Provided Headers vs. Provided Dataset without Headers</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234261#M5900</link>
      <description>&lt;P&gt;When you refer to headers, do you mean the header row&amp;nbsp;that refers to the column names? Sorry if it's a basic question.....just trying to understand.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2015 19:08:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234261#M5900</guid>
      <dc:creator>kannand</dc:creator>
      <dc:date>2015-11-11T19:08:31Z</dc:date>
    </item>
    <item>
      <title>Re: Provided Headers vs. Provided Dataset without Headers</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234285#M5901</link>
      <description>&lt;P&gt;No prob, yes the header row that refers to the column names&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2015 20:39:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234285#M5901</guid>
      <dc:creator>GalacticAbacus</dc:creator>
      <dc:date>2015-11-11T20:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: Provided Headers vs. Provided Dataset without Headers</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234287#M5902</link>
      <description>&lt;P&gt;Good question from Kannan. I was also wondering. Perhaps&amp;nbsp;you mean &lt;EM&gt;variable label&lt;/EM&gt;, i.e., a short description of a variable's content (e.g. "Patient number" for a variable named PATNO)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After all, even if the "headers" found in the raw data are some kind of "names", would we be sure that these names happen to&amp;nbsp;be valid SAS names? So, it would be safer to regard them just as "labels".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this case, there were several answers posted to a similar question in the SAS-L mailing list, 15 years ago:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://groups.google.com/forum/#!topic/comp.soft-sys.sas/awuwQAwP1AA" target="_blank"&gt;https://groups.google.com/forum/#!topic/comp.soft-sys.sas/awuwQAwP1AA&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 20px;"&gt;However, my impression was that your situation is slightly different.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 20px;"&gt;There is also a 2008 paper&amp;nbsp;&lt;A href="http://www.lexjansen.com/pharmasug/2008/cc/CC04.pdf" target="_blank"&gt;"Dynamically Create Variable Labels from Data Set Values"&lt;/A&gt;&amp;nbsp;which may be applicable, but I haven't checked that in detail either.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 20px;"&gt;Instead, I've quickly written two macros, which seem to work at least for the test data I've created (26 columns, 13 rows). The first changes the &lt;STRONG&gt;labels&lt;/STRONG&gt;&amp;nbsp;of the variables in dataset WHY to the "headers" found in the 1-observation dataset USEFUL, the second changes the variable &lt;STRONG&gt;names&lt;/STRONG&gt; correspondingly (assuming that the headers are in fact valid SAS variable names).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Macro to label variables in &amp;amp;DATA with labels found in &amp;amp;LABELS */

%macro lblvars(data=, labels=);

  /* Retrieve variable names */
  proc sql noprint;
  select name into :vn1 - :vn9999
    from dictionary.columns
    where libname='WORK' &amp;amp; memname=upcase("&amp;amp;data")
    order by varnum;
  quit;

  /* Retrieve variable labels */
  data _null_;
  set &amp;amp;labels;
  array lv[*] _character_;
  do i=1 to &amp;amp;sqlobs;
    call symput(cats('lbl',i), lv[i]);
  end;
  run;

  %put Now labeling &amp;amp;sqlobs variables ...;
   
  proc datasets nolist;
  modify &amp;amp;data;
  label 
  %do i=1 %to &amp;amp;sqlobs;
    &amp;amp;&amp;amp;vn&amp;amp;i="&amp;amp;&amp;amp;lbl&amp;amp;i"
  %end;;
  quit;

  %put ... Done.;
%mend lblvars;


/* Macro to rename variables in &amp;amp;DATA with new names found in &amp;amp;NAMES */

%macro renvars(data=, names=);

  /* Retrieve old variable names */
  proc sql noprint;
  select name into :vn1 - :vn9999
    from dictionary.columns
    where libname='WORK' &amp;amp; memname=upcase("&amp;amp;data")
    order by varnum;
  quit;

  /* Retrieve new variable names */
  data _null_;
  set &amp;amp;names;
  array nv[*] _character_;
  do i=1 to &amp;amp;sqlobs;
    call symput(cats('name',i), nv[i]);
  end;
  run;

  %put Now renaming &amp;amp;sqlobs variables ...;
   
  proc datasets nolist;
  modify &amp;amp;data;
  rename 
  %do i=1 %to &amp;amp;sqlobs;
    &amp;amp;&amp;amp;vn&amp;amp;i=&amp;amp;&amp;amp;name&amp;amp;i
  %end;;
  quit;

  %put ... Done.;
%mend renvars;


/* Create test data */

%let nvar=26;

data why;
array v[&amp;amp;nvar];
do i=1 to 13;
  do _n_=1 to &amp;amp;nvar;
    v[_n_]=ranuni(31416);
  end;
  output;
end;
drop i;
run;

data useful;
array hdr[&amp;amp;nvar] $40;
do _n_=1 to &amp;amp;nvar;
  hdr[_n_]=byte(64+_n_);
end;
run;

proc contents data=why;
run;


/* Apply the macros and see how meta data change */

%lblvars(data=why, labels=useful)

proc contents data=why;
run;

%renvars(data=why, names=useful)

proc contents data=why;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN style="line-height: 20px;"&gt;Of course, this is just unvalidated draft code and it comes with no warranties whatsoever. In particular, the macros might fail if the headers are invalid labels or names, respectively.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 20px;"&gt;Obviously, it is crucial that the n-th column of USEFUL contains the header for the&amp;nbsp;&lt;SPAN&gt;n-th column of WHY for all n=1, ..., 900+.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 20px;"&gt;&lt;SPAN&gt;As to your second question, I agree that it should be&amp;nbsp;easier to retrieve variable names and labels from raw data.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Edit:&lt;/STRONG&gt; For delimited raw data files such as CSV files there is in fact a way to retrieve variable names from the first record of the file: see &lt;A href="http://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#p18y8iz67dpzk7n1m765owrkhqou.htm" target="_blank"&gt;PROC IMPORT, GETNAMES statement&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Nov 2015 18:01:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234287#M5902</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2015-11-13T18:01:24Z</dc:date>
    </item>
    <item>
      <title>Re: Provided Headers vs. Provided Dataset without Headers</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234288#M5903</link>
      <description>&lt;P&gt;The answer is simple. Use a RENAME statement. Either in the program that reads the data or later using PROC DATASETS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can generate the rename statement from the list of variable names.&lt;/P&gt;
&lt;P&gt;So let's assume that you have created a SAS dataset with variables named VAR1 to VAR900.&lt;/P&gt;
&lt;P&gt;So you could read in the list of names and generate the rename statement with a simple data step.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename rename temp;
data _null_;
   infile 'headers' end=eof;
   length oldname newname $32 ;
   input newname;
   file rename ;
   if _n_=1 then put 'RENAME';
   oldname=cats('VAR',_n_);
   put oldname '=' newname ;
   if eof then put ';' ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now you can use that rename statement to change the names.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data fixed;
   set original;
%include rename ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2015 20:57:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234288#M5903</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-11-11T20:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: Provided Headers vs. Provided Dataset without Headers</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234294#M5904</link>
      <description>&lt;P&gt;Here is another way that might be simpler depending on what you have.......with a PROC SQL. &amp;nbsp; The IN dataset is what has the headers. The "test" dataset does not have proper headers but has names like v1, v2, v3, v4, v5. &amp;nbsp;This data is inserted into IN as shown below....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA IN;
	 SET SASHELP.CLASS(OBS=1);
RUN;

data test;
	infile datalines dlm='|';
	input  V1:$8. V2:$1. V3:4. V4:4. V5:4.;
datalines;
Alice|F|13|56.5|84.0
Barbara|F|13|65.3|98.0
;
RUN;
PROC SQL;
	INSERT INTO IN SELECT * FROM TEST;
QUIT;

PROC PRINT DATA=IN;TITLE '==IN';
PROC PRINT DATA=TEST;TITLE '==TEST';&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Please note that this involves I/O read/writes but is a simple INSERT statement interms of coding.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The output results shows this below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;==IN
Obs	Name	Sex	Age	Height	Weight
1	Alfred	M	14	69.0	112.5
2	Alice	F	13	56.5	84.0
3	Barbara	F	13	65.3	98.0
==TEST
Obs	V1	V2	V3	V4	V5
1	Alice	F	13	56.5	84
2	Barbara	F	13	65.3	98&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hope this helps...!!!&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2015 21:19:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234294#M5904</guid>
      <dc:creator>kannand</dc:creator>
      <dc:date>2015-11-11T21:19:31Z</dc:date>
    </item>
    <item>
      <title>Re: Provided Headers vs. Provided Dataset without Headers</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234429#M5907</link>
      <description>&lt;P&gt;Hi, I believe your solution is what I need but is coded in a way I don't quite follow.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've outlined what I think you are doing... would you mind elaborating?&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token statement"&gt;filename&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;rename&lt;/SPAN&gt; temp&lt;SPAN class="token punctuation"&gt;;              &lt;STRONG&gt;(I assume this is renaming the temp table I'm creating)&lt;/STRONG&gt;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; _null_&lt;SPAN class="token punctuation"&gt;;                       &lt;STRONG&gt;(don't create table when executing the following functions)&lt;/STRONG&gt;&lt;/SPAN&gt;
   &lt;SPAN class="token statement"&gt;infile&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;'headers'&lt;/SPAN&gt; end&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;eof&lt;SPAN class="token punctuation"&gt;;       &lt;STRONG&gt;(read the file 'headers into SAS)&lt;/STRONG&gt;&lt;/SPAN&gt;
   &lt;SPAN class="token function"&gt;length&lt;/SPAN&gt; oldname newname &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;32&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;;    &lt;STRONG&gt;(create two new variables 'oldname' &amp;amp; 'newname' length $32)&lt;/STRONG&gt;&lt;/SPAN&gt;
   &lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt; newname&lt;SPAN class="token punctuation"&gt;;                  &lt;STRONG&gt;(specify perviously created variable 'newname'?)&lt;/STRONG&gt;&lt;/SPAN&gt;
   &lt;SPAN class="token statement"&gt;file&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;rename&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;;                   &lt;STRONG&gt;(Here is the rename statement but is what follows what is being defined as my old value and new value?)&lt;/STRONG&gt;&lt;/SPAN&gt;
   &lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; _n_&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;put&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;'RENAME'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;     &lt;STRONG&gt;(If the first time the data step has iterated = 1 then....what is put 'RENAME' doing?)&lt;/STRONG&gt;&lt;/SPAN&gt;
   oldname&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;cats&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'VAR'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;_n_&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
   &lt;SPAN class="token keyword"&gt;put&lt;/SPAN&gt; oldname &lt;SPAN class="token string"&gt;'='&lt;/SPAN&gt; newname &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
   &lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; eof &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;put&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;';'&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Nov 2015 18:19:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234429#M5907</guid>
      <dc:creator>GalacticAbacus</dc:creator>
      <dc:date>2015-11-12T18:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: Provided Headers vs. Provided Dataset without Headers</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234438#M5909</link>
      <description>&lt;P&gt;This step just creates a file with the rename statement. The syntax for a rename statement is: RENAME old=new old=new .... ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* Create a temporary file to store the generated code ;
* Use the filref of RENAME to refer to it.;
filename rename temp; 

* Run a datastep without any output datasets ;
data _null_;  

* Read from the text file that lists the headers. Set EOF flag ;
   infile 'headers' end=eof;   

* Define two variables to use to store the names. SAS names are limited to 32 bytes. ;
   length oldname newname $32 ;  

* Read the next name from the input file. ;
   input newname; 

* Generate the next dummy name by concatenating the loop counter to the string 'VAR' ;
   oldname=cats('VAR',_n_);

* Specity that PUT statement output will go the temporary file instead of the log ;    
   file rename ;

* First time through write the beginning of the rename statement ; 
   if _n_=1 then put 'RENAME';    

* Write the old=new pair for this name ;
   put oldname '=' newname ;

* When at the end of the input then write the semi-colon to finish the  rename statement. ;
   if eof then put ';' ;

* End of the data step definition ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Nov 2015 19:01:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234438#M5909</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-11-12T19:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: Provided Headers vs. Provided Dataset without Headers</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234473#M5914</link>
      <description>&lt;P&gt;Hi, thank you very much for talking the time to walk me through the code. If I could ask a couple more questions,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the "infile" statement is what is causing some confusion as I'm getting the error, "not found within the current file path" and it's trying to find my file somewhere other than my "SAS.WORK" directory. The file I am reading from, containing my headers, is a temporary file sitting in my work directory. &amp;nbsp;I checked out other portions of your code by doing some reading and running them seperatly. The concatenation of string "var" with the counter makes sense....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The other part is we seem to be defining "oldname". I assume (input newname;) is where we are reading the variable within my "headers" table as the "newname" to be swapped for "oldname". &amp;nbsp;I think the rest makes sense.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Nov 2015 20:29:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234473#M5914</guid>
      <dc:creator>GalacticAbacus</dc:creator>
      <dc:date>2015-11-12T20:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: Provided Headers vs. Provided Dataset without Headers</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234486#M5915</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/20129"&gt;@GalacticAbacus&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi, thank you very much for talking the time to walk me through the code. If I could ask a couple more questions,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the "infile" statement is what is causing some confusion as I'm getting the error, "not found within the current file path" and it's trying to find my file somewhere other than my "SAS.WORK" directory. The file I am reading from, containing my headers, is a temporary file sitting in my work directory. &amp;nbsp;I checked out other portions of your code by doing some reading and running them seperatly. The concatenation of string "var" with the counter makes sense....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The other part is we seem to be defining "oldname". I assume (input newname;) is where we are reading the variable within my "headers" table as the "newname" to be swapped for "oldname". &amp;nbsp;I think the rest makes sense.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It is extremely unlikely that the default directory is the directory that SAS creates automatically for the WORK library. &amp;nbsp;It would normally be the current working directory when the SAS command started running. Or you can change it by running the operarting system's cd command. If the file you want want to read is not in the current working directory then just include the fully quailified name of the file inside the quotes. If the file actual is in your work directory you can use the PATHNAME() function to find out where the WORK library is pointing. So you could change the INFILE to something like this:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;INFILE "%sysfunc(pathname(work))/headers.txt" end=eof ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But that is very unlikely to be what you mean. It is more likely that you mean you have already read the headers into a SAS dataset in the WORK library. &amp;nbsp;If it is a dataset with one observation per header name then just replace the INFILE and INPUT statements with a SET statement. You will also not need the variable NEWNAME as you can just use the variable that already has the names instead. &amp;nbsp;The SET statement also supports the END= option so that you can tell when you get to the end of the list.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* Replace these ;
* INFILE 'header' end=eof' ;
* input newname ;
* With  ;
SET headers END=EOF ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If the names of the variables that you created when you read the file without the headers are not VAR1 to VAR900 then you will need a similar list of variable names so that you know which old name goes with which new name. &amp;nbsp;If you don't have such a dataset you can generate a dataset with one observation per variable stored in a varaible named _NAME_ by using proc transpose. &amp;nbsp;So if your existing dataset that you want to rename the variables for is named WANT then you can make a dataset named OLDNAMES using this procedure call.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=want(obs=0) out=oldnames ;
  var _all_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Nov 2015 21:18:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234486#M5915</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-11-12T21:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: Provided Headers vs. Provided Dataset without Headers</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234496#M5916</link>
      <description>&lt;P&gt;Hi, thank you very much for talking the time to walk me through the code. If I could ask a couple more questions,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the "infile" statement is what is causing some confusion as I'm getting the error, "not found within the current file path" and it's trying to find my file somewhere other than my "SAS.WORK" directory. The file I am reading from, containing my headers, is a temporary file sitting in my work directory. &amp;nbsp;I checked out other portions of your code by doing some reading and running them seperatly. The concatenation of string "var" with the counter makes sense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The other part is we seem to be defining "oldname". I assume (input newname;) is where we are reading the variable within my "headers" table as the "newname" to be swapped for "oldname". &amp;nbsp;I think the rest makes sense.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Nov 2015 21:23:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234496#M5916</guid>
      <dc:creator>GalacticAbacus</dc:creator>
      <dc:date>2015-11-12T21:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: Provided Headers vs. Provided Dataset without Headers</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234503#M5917</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/20129"&gt;@GalacticAbacus﻿&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;I'm just curious: Did you give my RENVARS macro a try? It was tailored to the situation you described in your initial post, i.e. two datasets with the same number of variables (900+). Tom's elegant original solution assumed that the "headers" data are a .txt file. Moreover, it required that the variable names of your dataset "WHY" are VAR1, VAR2, etc., whereas&amp;nbsp;macro RENVARS does not make such an assumption.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Nov 2015 21:38:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234503#M5917</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2015-11-12T21:38:47Z</dc:date>
    </item>
    <item>
      <title>Re: Provided Headers vs. Provided Dataset without Headers</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234512#M5918</link>
      <description>&lt;P&gt;Hi, I think I am almost there, you were correct in that I ment I had a SAS dataset in my WORK&amp;nbsp;library.&lt;/P&gt;
&lt;P&gt;I have two datasets, both I've read into SAS as SAS datasets within my WORK library.&lt;/P&gt;
&lt;P&gt;&amp;lt;&amp;gt; Dataset_1 = &lt;STRONG&gt;Work.Headerfile&lt;/STRONG&gt;, with one variable "Name Convention" which is a list of my headers.&lt;/P&gt;
&lt;P&gt;&amp;lt;&amp;gt; Dataset_2 = &lt;STRONG&gt;Work.Set_1&lt;/STRONG&gt;, with 900+ variables and 1.2 million rows. Each variable data is under a header F"n", or F1, F2, F3, etc. out to F900.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the alteration to the code: This ran, I'm working to see if it did what I wished.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;filename rename temp;&lt;BR /&gt;data _null_;&lt;BR /&gt;Set HEADER_FILE end=eof;&lt;BR /&gt;length oldname Name_Convention $32;&lt;BR /&gt;oldname = cats('F',_n_);&lt;BR /&gt;file rename;&lt;BR /&gt;if _n_ = 1 THEN PUT Name_Convention;&lt;BR /&gt;put oldname=Name_Convention;&lt;BR /&gt;if eof then put ';';&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;While it seemed to run and if I replaced _null_ with the an output table name, the resulting data looked correct... (two variables, one with my desired header names, the other with variable "oldname" looking like F1 - F900... I then proceeded with&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATA fixed;&lt;BR /&gt; set Set_1;&lt;BR /&gt;%include rename ;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It ran, but did not complete came up with&amp;nbsp;&lt;STRONG&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;I the length of "Name Convention" is also already set so I am unable to apply format $32.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Nov 2015 22:08:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234512#M5918</guid>
      <dc:creator>GalacticAbacus</dc:creator>
      <dc:date>2015-11-12T22:08:21Z</dc:date>
    </item>
    <item>
      <title>Re: Provided Headers vs. Provided Dataset without Headers</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234521#M5919</link>
      <description>&lt;P&gt;Do you still have the raw files with the headers and the data? Are the text files? Are the fields delimited?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's assume that you have text files that are delimited. &amp;nbsp;For example CSV files that look like these two:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data.csv&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Alfred,M,14,69,112.5
Alice,F,13,56.5,84
Barbara,F,13,65.3,98
Carol,F,14,62.8,102.5
Henry,M,14,63.5,102.5&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;headers.csv&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Name,Sex,Age,Height,Weight&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So you could use PROC IMPORT to read the data file&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import file='data.csv' dbms=dlm 
  out=mydata replace;
  delimiter=',';
  getnames=no;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and it will generate a dataset&amp;nbsp;with variables named VAR1 to VAR5 .&lt;/P&gt;
&lt;P&gt;You could do the same to the headers file and it will also generate a dataset with variables names VAR1-VAR5 ;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import file='headers.csv' dbms=dlm 
  out=myheaders replace;
  delimiter=',';
  getnames=no;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You could then convert that dataset using PROC TRANSPOSE to one row per variable and two columns, _NAME_ and COL1.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=myheaders out=mynames ;
  var _all_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So you get a dataset whose contents looks like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;STRONG&gt;_NAME_ COL1&lt;/STRONG&gt;
 VAR1  Name
 VAR2  Sex
 VAR3  Age
 VAR4  Height
 VAR5  Weight
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now you have the information you need to generate the OLD=NEW pairs needed for a RENAME statement to fix the variable names in the dataset&amp;nbsp;that has the actual data. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you only have 900 variables you could even generate the list of pairs into a macro variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint ;
  select catx('=',_name_,col1)
    into :renames separated by ' ' 
    from mynames
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can then use that macro variable to generate the required RENAME statement or dataset option.&lt;/P&gt;
&lt;P&gt;For example you could copy the data into a new database and change the variable names using a data step like this.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data final ;
   set mydata ;
   rename &amp;amp;renames ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Or you could look into how to use PROC DATASETS to rename the variables without copying the data.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Nov 2015 22:23:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234521#M5919</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-11-12T22:23:41Z</dc:date>
    </item>
    <item>
      <title>Re: Provided Headers vs. Provided Dataset without Headers</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234530#M5920</link>
      <description>&lt;P&gt;You need to change:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if _n_ = 1 THEN PUT Name_Convention;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if _n_ = 1 THEN PUT 'RENAME';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So that it will write the text RENAME to the file. This the beginning of the RENAME command.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to change:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;put oldname=Name_Convention;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 20px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;put oldname '=' Name_Convention;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;so that the equal sign is written to the file. &amp;nbsp;By not quoting the text literal you have asked SAS to write the variable OLDNAME using named format. So of oldname was 'F1' and Name_Convention was 'ID' it would end up witing something &amp;nbsp;'OLDNAME=F1 ID' to the file instead of 'F1=ID'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want you can run this step to read in the file you created and dump it to the log so you can see what is in it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   infile rename ;
   input;
   put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Nov 2015 23:39:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234530#M5920</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-11-12T23:39:56Z</dc:date>
    </item>
    <item>
      <title>Re: Provided Headers vs. Provided Dataset without Headers</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234658#M5927</link>
      <description>&lt;P&gt;Hi Freelance!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I gravitated toward Tom's solution because I really enjoy learning exactly why and how something works before I apply it, and while I'm grateful for your taking the time to write the macro solution, it looked a little beyond my current abilities to undertand. I am grateful for the example thought.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Nov 2015 16:59:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234658#M5927</guid>
      <dc:creator>GalacticAbacus</dc:creator>
      <dc:date>2015-11-13T16:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: Provided Headers vs. Provided Dataset without Headers</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234677#M5929</link>
      <description>&lt;P&gt;Hi Tom,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will try to make time to do the following excersies just to become more familiar with basic sql processes. I used more sql in the past than I do now and I've gotten a little rusty, and I did not know much to begin with. I do wish to learn it through and through however so thanks for outlining in detail.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have corrected my code, ran the macro and called the macro and it seems to run correctly, however the columns are mis-matched by one, with the first column name being "RENAME" which I assume is caused by if _n_=1 then put 'RENAME'?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just so I understand, I believe my confusion came from not understanding we were constructing an ad-hoc function via kind-of custom cancatenating some text. If the function "RENAME" is (RENAME &amp;nbsp;"old" = "new";), so in my case, I'm brining in "RENAME" and "=", and constructing "old" and "new".&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;RENAME &amp;nbsp;&lt;/STRONG&gt;cats('F',_n_) &amp;nbsp;&lt;STRONG&gt;=&lt;/STRONG&gt;&amp;nbsp; Name_Convention;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Nov 2015 18:34:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234677#M5929</guid>
      <dc:creator>GalacticAbacus</dc:creator>
      <dc:date>2015-11-13T18:34:11Z</dc:date>
    </item>
    <item>
      <title>Re: Provided Headers vs. Provided Dataset without Headers</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234683#M5930</link>
      <description>&lt;P&gt;The program should be generating a rename statement. &amp;nbsp;If you have three variables named F1,F2,F3 that you want to rename to ID, NAME,AGE then the program should generate a file that looks like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;RENAME
F1 =ID
F2 =NAME
F3 =AGE
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If the names are off by one then the logic that you are using to generate F1, F2, etc is off by one. &amp;nbsp;If you cannot figure out why that happened but it is consistently happening then just adjust the statement that is generating the old names. &amp;nbsp;So if you changed it to&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;oldname = cats('F',_N_ + 1) ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;then it would generate.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;RENAME
F2 =ID
F3 =NAME
F4 =AGE
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Nov 2015 19:09:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234683#M5930</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-11-13T19:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: Provided Headers vs. Provided Dataset without Headers</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234868#M5950</link>
      <description>&lt;P&gt;Hi Tom,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I actually corrected it last week and it worked fine. Thx again for the help, I'll approve the starting solution and work on applying the general concepts here. Great learning for me so I appreciate the time spent.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;TS&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2015 14:30:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Provided-Headers-vs-Provided-Dataset-without-Headers/m-p/234868#M5950</guid>
      <dc:creator>GalacticAbacus</dc:creator>
      <dc:date>2015-11-16T14:30:57Z</dc:date>
    </item>
  </channel>
</rss>

