<?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 Error while exporting SAS Dataset with 8chars FORMAT names to SAS XPT V5 via PROC COPY in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Error-while-exporting-SAS-Dataset-with-8chars-FORMAT-names-to/m-p/720220#M223093</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I am having issues exporting a SAS Dataset to XPT V5 by using PROC COPY.&lt;/P&gt;&lt;P&gt;This dataset has some columns associated to formats whose name is 8 chars long: this should be acceptable, according to&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=movefile&amp;amp;docsetTarget=n0167z9rttw8dyn15z1qqe8eiwzf.htm&amp;amp;locale=en" target="_self"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=movefile&amp;amp;docsetTarget=n0167z9rttw8dyn15z1qqe8eiwzf.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I just remove one char from format name, making it 7 chars long, it works like a charm.&lt;/P&gt;&lt;P&gt;I attached sas program and sample csv to reproduce the issue.&lt;/P&gt;&lt;P&gt;What am i doing wrong?&lt;/P&gt;&lt;P&gt;Please help, thanks&lt;/P&gt;</description>
    <pubDate>Thu, 18 Feb 2021 15:40:15 GMT</pubDate>
    <dc:creator>massigrillo</dc:creator>
    <dc:date>2021-02-18T15:40:15Z</dc:date>
    <item>
      <title>Error while exporting SAS Dataset with 8chars FORMAT names to SAS XPT V5 via PROC COPY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-while-exporting-SAS-Dataset-with-8chars-FORMAT-names-to/m-p/720220#M223093</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I am having issues exporting a SAS Dataset to XPT V5 by using PROC COPY.&lt;/P&gt;&lt;P&gt;This dataset has some columns associated to formats whose name is 8 chars long: this should be acceptable, according to&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=movefile&amp;amp;docsetTarget=n0167z9rttw8dyn15z1qqe8eiwzf.htm&amp;amp;locale=en" target="_self"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=movefile&amp;amp;docsetTarget=n0167z9rttw8dyn15z1qqe8eiwzf.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I just remove one char from format name, making it 7 chars long, it works like a charm.&lt;/P&gt;&lt;P&gt;I attached sas program and sample csv to reproduce the issue.&lt;/P&gt;&lt;P&gt;What am i doing wrong?&lt;/P&gt;&lt;P&gt;Please help, thanks&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 15:40:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-while-exporting-SAS-Dataset-with-8chars-FORMAT-names-to/m-p/720220#M223093</guid>
      <dc:creator>massigrillo</dc:creator>
      <dc:date>2021-02-18T15:40:15Z</dc:date>
    </item>
    <item>
      <title>Re: Error while exporting SAS Dataset with 8chars FORMAT names to SAS XPT V5 via PROC COPY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-while-exporting-SAS-Dataset-with-8chars-FORMAT-names-to/m-p/720232#M223101</link>
      <description>&lt;P&gt;It is counting the required $ is part of the name for a character format.&amp;nbsp; This is definitely how I have used SAS since even before version 5.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that SAS will work with a name of ABCDEFGH because if the variable is character it will assume you meant to reference a character format and add the $ so that it really searches for $ABCDEFGH.&lt;/P&gt;
&lt;PRE&gt;167   data test;
168     set sashelp.class;
169     format name ABCDEFGH. ;
                    ---------
                    484
NOTE 484-185: Format $ABCDEFGH was not found or could not be loaded.

170   run;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 16:04:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-while-exporting-SAS-Dataset-with-8chars-FORMAT-names-to/m-p/720232#M223101</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-02-18T16:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: Error while exporting SAS Dataset with 8chars FORMAT names to SAS XPT V5 via PROC COPY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-while-exporting-SAS-Dataset-with-8chars-FORMAT-names-to/m-p/720238#M223106</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;actually if I remove the $ sign here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;format
      FIELD1 AAAAAAAA.                                                                                                                                                                                         
      FIELD2 BBBBBBB.
;&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;it keeps on working, provided that I remove the last char of longer format;&lt;/P&gt;&lt;P&gt;otherwise if I keep the name untouched, it says that&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;ERROR: The format name $AAAAAAAA is illegal for file XPORTOUT.DATA.DATA.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname csvlib "/folders/myfolders/csv";
libname xportout xport "/folders/myfolders/test.xpt";

options fmtsearch = (csvlib.formats);  
                                                                                                                                                                                           
proc format library=csvlib;                                                                                                                                                                     
	value $AAAAAAAA
		"1" = "One"
		"2" = "Two"
		"3" = "Three"
	;                                                                                                                                                                     
	value $BBBBBBB
		"4" = "Four"
		"5" = "Five"
		"6" = "Six"
	;
;
run;

data csvlib.DATA;
	infile "/folders/myfolders/test.csv"
		delimiter=","
		missover
		dsd 
		firstobs=2
	;
    label
		FIELD1 = "Field One"
		FIELD2 = "Field Two"
		FIELD3 = "Field Three"
	;
	length
		FIELD1 $2.
		FIELD2 $2.
		FIELD3 $100.
	;
	format
      FIELD1 AAAAAAAA.                                                                                                                                                                                         
      FIELD2 BBBBBBB.
	;
	input
        FIELD1 $
        FIELD2 $
        FIELD3 $
	;
run;

proc copy 
	in=csvlib
	out=xportout
	memtype=data
	;
run;

libname csvlib clear;
libname xportout clear;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;so you're telling me I'm doing nothing wrong, it is just the way it works?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 16:18:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-while-exporting-SAS-Dataset-with-8chars-FORMAT-names-to/m-p/720238#M223106</guid>
      <dc:creator>massigrillo</dc:creator>
      <dc:date>2021-02-18T16:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: Error while exporting SAS Dataset with 8chars FORMAT names to SAS XPT V5 via PROC COPY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-while-exporting-SAS-Dataset-with-8chars-FORMAT-names-to/m-p/720280#M223118</link>
      <description>&lt;P&gt;SAS will sometimes "correct" your code to add those automatically, so it's implicit $ rather than explicit, it still takes up the space would be my guess. The log usually indicates if this has happened though - what does the log show for the code shown?&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 17:53:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-while-exporting-SAS-Dataset-with-8chars-FORMAT-names-to/m-p/720280#M223118</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-02-18T17:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: Error while exporting SAS Dataset with 8chars FORMAT names to SAS XPT V5 via PROC COPY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-while-exporting-SAS-Dataset-with-8chars-FORMAT-names-to/m-p/720415#M223178</link>
      <description>&lt;P&gt;ok, probably my previous reply was somehow misleading, let me reformulate the question:&lt;/P&gt;&lt;P&gt;I have a dataset that has a format whose name is 8 characters PLUS the $ sign, meaning it's a string, not a number:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="sas"&gt;value $AAAAAAAA
		"1" = "One"
		"2" = "Two"
		"3" = "Three"
	;     &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I have to export this dataset in SAS XPT format, version 5, and I use proc copy for this purpose&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="sas"&gt;proc copy 
	in=csvlib
	out=xportout
	memtype=data
	;
run;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but I have following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;ERROR: The format name $AAAAAAAA is illegal for file XPORTOUT.DATA.DATA.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;According to SAS xpt specification (see &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=movefile&amp;amp;docsetTarget=n0167z9rttw8dyn15z1qqe8eiwzf.htm&amp;amp;locale=en" target="_self"&gt;here&lt;/A&gt;) a format name 8 chars long should be acceptable&lt;/SPAN&gt;&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="massigrillo_0-1613730081398.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54928iF7058B72401B17ED/image-size/medium?v=v2&amp;amp;px=400" role="button" title="massigrillo_0-1613730081398.png" alt="massigrillo_0-1613730081398.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It seems instead that proc copy is counting the $ as one of the char of the name, thus considering as 9 characters long.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Tom confirmed this.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So my question is,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;is there some option making proc copy to skip this validation check, or is there an alternative procedure/macro to achive the goal of having the xpt export without modifying the format name?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 10:25:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-while-exporting-SAS-Dataset-with-8chars-FORMAT-names-to/m-p/720415#M223178</guid>
      <dc:creator>massigrillo</dc:creator>
      <dc:date>2021-02-19T10:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: Error while exporting SAS Dataset with 8chars FORMAT names to SAS XPT V5 via PROC COPY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-while-exporting-SAS-Dataset-with-8chars-FORMAT-names-to/m-p/720517#M223201</link>
      <description>&lt;P&gt;Perhaps with actual version 5 (or earlier of SAS) you could have attached a character format with 8 characters (plus the $) but I seriously doubt it.&amp;nbsp; &amp;nbsp;But even if you modify the transport file to change the 8 character field where the format name is stored to remove the leading $ and instead use all 8 positions for the name it will not work.&amp;nbsp; SAS when it tries to read that data will replace the first position with a $.&amp;nbsp; See example program below.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format ;
value $SHORT low-high = 'short name';
value $TOOLONGB low-high = '8 letter name' ;
value $OOLONGB low-high = '$ over first letter' ;
run;

data test;
  x='1'; y='2';
  format y $short. ;
run;

proc print data=test;
run;


* make some temporary files to use as XPT files ;
filename xxx temp;
filename yyy temp;

* Add dataset to XPT file ;
libname out xport "%sysfunc(pathname(xxx))";
data out.test; set test; run;

* Make a copy of XPT file replacing $SHORT with TOOLONGB ;
data _null_;
  infile xxx recfm=f lrecl=80  ;
  file yyy recfm=f lrecl=80 ;
  input;
  _infile_=tranwrd(_infile_,'$SHORT  ','TOOLONGB');
  put _infile_ $char80. ;
run;

* Point a libref to the updated XPT file ;
libname new xport "%sysfunc(pathname(yyy))";  

data test2; set new.test; run;

proc print data=test2; run;

proc contents data=new.test; run;
proc contents data=out.test; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 17:20:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-while-exporting-SAS-Dataset-with-8chars-FORMAT-names-to/m-p/720517#M223201</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-02-19T17:20:55Z</dc:date>
    </item>
    <item>
      <title>Re: Error while exporting SAS Dataset with 8chars FORMAT names to SAS XPT V5 via PROC COPY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-while-exporting-SAS-Dataset-with-8chars-FORMAT-names-to/m-p/720520#M223202</link>
      <description>is there some option making proc copy to skip this validation check, or is there an alternative procedure/macro to achive the goal of having the xpt export without modifying the format name?&lt;BR /&gt;&lt;BR /&gt;Unfortunately, No and No AFAIK. V5 is an antiquated transfer format, so I wouldn't expect any development around it either.</description>
      <pubDate>Fri, 19 Feb 2021 17:30:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-while-exporting-SAS-Dataset-with-8chars-FORMAT-names-to/m-p/720520#M223202</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-02-19T17:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: Error while exporting SAS Dataset with 8chars FORMAT names to SAS XPT V5 via PROC COPY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-while-exporting-SAS-Dataset-with-8chars-FORMAT-names-to/m-p/720528#M223209</link>
      <description>&lt;P&gt;Add you own logic to "fix" the format that is attached.&amp;nbsp; Here is code that truncate the long the format names.&amp;nbsp; If you use the NOFMTERR option then it will run.&amp;nbsp; &amp;nbsp;Of course if these truncated formats do not exist then you will have a different issue to solve.&amp;nbsp; Perhaps you could also have code that renames the format definitions.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let inlib=WORK;
%let outlib=OUT;
%let member=TEST;


proc sql noprint;
select catx(' '
     ,name
     , cats(case when (type='char') then '$'||substr(format,3,7) else substr(format,1,8) end,'.')
     )
  into :reformat separated by ' '
from dictionary.columns
where libname=%upcase("&amp;amp;inlib") and memname=%upcase("&amp;amp;member")
  and length(format)&amp;gt;8
;
%let n=&amp;amp;sqlobs;
quit;

data &amp;amp;outlib..&amp;amp;member;
  set &amp;amp;member;
%if &amp;amp;n %then %do;
  format &amp;amp;reformat ;
%end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Feb 2021 17:56:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-while-exporting-SAS-Dataset-with-8chars-FORMAT-names-to/m-p/720528#M223209</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-02-19T17:56:32Z</dc:date>
    </item>
  </channel>
</rss>

