<?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: I want to convert TIMSS 2015 SAS export data files into SAS data files. in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/I-want-to-convert-TIMSS-2015-SAS-export-data-files-into-SAS-data/m-p/770205#M30856</link>
    <description>&lt;P&gt;If you're using SAS Studio you are probably using a SAS environment that is centralized. Maybe SAS OnDemand for Academics?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You cannot access your local file system directly. Instead, if you have data to upload (and results to download) you must first place them in a file path that SAS can access. Use the Upload function in SAS Studio to put your data into a place where SAS can reference it. Then use the Download features to copy data to a local folder if needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The "C:\Users..." paths in this macro call would need to change.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%DOIT (TYPE = ACG ASA ASG ASH ASR AST ATG
BCG BSA BSG BSR BST BTM BTS ,
INDIR = C:\Users\〇〇(it's my name)\OneDrive - △△(it's my university's name).jp\デスクトップ\TIMSS2015_SASData,
OUTDIR = C:\Users\〇〇\OneDrive - △△.jp\デスクトップ\TIMSS SASデータ移行用) ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;Update&lt;/STRONG&gt;:&lt;/P&gt;
&lt;P&gt;I worked on a code method that seems to work more reliably than the T15_CONVERT.SAS sample that is provided by TIMSS 2015 site.&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;/* folder where the TIMSS *.exp files are */
%let in  = /home/myid/folder-with-exp-files;

/* folder to contain the converted data sets*/
%let out = /home/myid/folder-for-datasets;

data filenames;
length fref $8 fname $200;
did = filename(fref, "&amp;amp;in.");
did = dopen(fref);
do i = 1 to dnum(did);
  fname = dread(did,i);
  output;
end;
did = dclose(did);
did = filename(fref);
keep fname;
run;

libname outdir "&amp;amp;out.";

%macro convert(rootname=);
      PROC CIMPORT FILE="&amp;amp;in./&amp;amp;rootname..exp"
                   DATA=OUTDIR.&amp;amp;rootname. ;
      RUN; 
%mend;

data _null_;
 set filenames;
 root = scan(fname,1,".");
 call execute(%nrstr("%convert(rootname="||root||");"));
run;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 24 Sep 2021 18:23:04 GMT</pubDate>
    <dc:creator>ChrisHemedinger</dc:creator>
    <dc:date>2021-09-24T18:23:04Z</dc:date>
    <item>
      <title>I want to convert TIMSS 2015 SAS export data files into SAS data files.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/I-want-to-convert-TIMSS-2015-SAS-export-data-files-into-SAS-data/m-p/770102#M30854</link>
      <description>&lt;P&gt;Hi, this is fuka-japan.&lt;/P&gt;&lt;P&gt;I need TIMSS2015 data for my study.&lt;/P&gt;&lt;P&gt;So, I want to convert TIMSS 2015 SAS export data files into SAS data files with SAS studio.&lt;/P&gt;&lt;P&gt;However, when I enter the file pass of the export data files, it says " not exist."&lt;/P&gt;&lt;P&gt;I'm not familiar with SAS, so I don't know what to do.&lt;/P&gt;&lt;P&gt;please help me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code:&lt;/P&gt;&lt;P&gt;/******************************************************************************/&lt;BR /&gt;/* */&lt;BR /&gt;/* SAS Program to Convert SAS Export Files to SAS Data Files */&lt;BR /&gt;/* TIMSS 2015 User Guide */&lt;BR /&gt;/* */&lt;BR /&gt;/******************************************************************************/&lt;/P&gt;&lt;P&gt;OPTIONS NONOTES MPRINT ;&lt;/P&gt;&lt;P&gt;%MACRO DOIT (TYPE = ,&lt;BR /&gt;INDIR = ,&lt;BR /&gt;OUTDIR = ) ;&lt;/P&gt;&lt;P&gt;LIBNAME OUTDIR "&amp;amp;OUTDIR" ;&lt;/P&gt;&lt;P&gt;* Start of file type processing loop ;&lt;/P&gt;&lt;P&gt;%DO F = 1 %TO %SYSFUNC(COUNTW(&amp;amp;TYPE)) ;&lt;BR /&gt;%LET FTYPE = %SCAN(&amp;amp;TYPE,&amp;amp;F) ;&lt;/P&gt;&lt;P&gt;* List of TIMSS 2015 fourth grade countries ;&lt;/P&gt;&lt;P&gt;%IF %UPCASE(%SUBSTR(&amp;amp;FTYPE,1,1)) = A %THEN %DO ;&lt;/P&gt;&lt;P&gt;%LET COUNTRY = AUS BHR BFL BGR CAN CHL TWN HRV CYP CZE&lt;BR /&gt;DNK ENG FIN FRA GEO DEU HKG HUN IDN IRN&lt;BR /&gt;IRL ITA JPN KAZ KOR KWT LTU MAR NLD NZL&lt;BR /&gt;NIR NOR OMN POL PRT QAT RUS SAU SRB SGP&lt;BR /&gt;SVK SVN ESP SWE TUR ARE USA&lt;BR /&gt;ABA COT CQU NO4 AAD ADU ;&lt;/P&gt;&lt;P&gt;%END ;&lt;/P&gt;&lt;P&gt;* List of TIMSS 2015 eighth grade countries ;&lt;/P&gt;&lt;P&gt;%IF %UPCASE(%SUBSTR(&amp;amp;fTYPE,1,1)) = B %THEN %DO ;&lt;/P&gt;&lt;P&gt;%LET COUNTRY = AUS BHR BWA CAN CHL TWN EGY ENG GEO HKG&lt;BR /&gt;HUN IRN IRL ISR ITA JPN JOR KAZ KOR KWT&lt;BR /&gt;LBN LTU MYS MLT MAR NZL NOR OMN QAT RUS&lt;BR /&gt;SAU SGP SVN ZAF SWE THA TUR ARE USA&lt;BR /&gt;ABA COT CQU NO8 AAD ADU ;&lt;/P&gt;&lt;P&gt;%END ;&lt;/P&gt;&lt;P&gt;* Start of country processing loop ;&lt;/P&gt;&lt;P&gt;%LET I = 1 ;&lt;BR /&gt;%DO %WHILE(%LENGTH(%SCAN(&amp;amp;COUNTRY,&amp;amp;I))) ;&lt;BR /&gt;%LET CTRY = %SCAN(&amp;amp;COUNTRY,&amp;amp;I) ;&lt;/P&gt;&lt;P&gt;PROC CIMPORT FILE="&amp;amp;INDIR.\&amp;amp;FTYPE&amp;amp;CTRY.M6.EXP"&lt;BR /&gt;DATA=OUTDIR.&amp;amp;FTYPE&amp;amp;CTRY.M6 ;&lt;BR /&gt;RUN ;&lt;/P&gt;&lt;P&gt;* End of country processing loop ;&lt;/P&gt;&lt;P&gt;%LET I = %EVAL(&amp;amp;I + 1) ;&lt;BR /&gt;%END ;&lt;/P&gt;&lt;P&gt;* End of file type processing loop ;&lt;/P&gt;&lt;P&gt;%END ;&lt;/P&gt;&lt;P&gt;%MEND DOIT ;&lt;/P&gt;&lt;P&gt;%DOIT (TYPE = ACG ASA ASG ASH ASR AST ATG&lt;BR /&gt;BCG BSA BSG BSR BST BTM BTS ,&lt;BR /&gt;INDIR = C:\Users\〇〇(it's my name)\OneDrive - △△(it's my university's name).jp\デスクトップ\TIMSS2015_SASData,&lt;BR /&gt;OUTDIR = C:\Users\〇〇\OneDrive - △△.jp\デスクトップ\TIMSS SASデータ移行用) ;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Sep 2021 05:20:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/I-want-to-convert-TIMSS-2015-SAS-export-data-files-into-SAS-data/m-p/770102#M30854</guid>
      <dc:creator>fuka-japan</dc:creator>
      <dc:date>2021-09-24T05:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: I want to convert TIMSS 2015 SAS export data files into SAS data files.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/I-want-to-convert-TIMSS-2015-SAS-export-data-files-into-SAS-data/m-p/770205#M30856</link>
      <description>&lt;P&gt;If you're using SAS Studio you are probably using a SAS environment that is centralized. Maybe SAS OnDemand for Academics?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You cannot access your local file system directly. Instead, if you have data to upload (and results to download) you must first place them in a file path that SAS can access. Use the Upload function in SAS Studio to put your data into a place where SAS can reference it. Then use the Download features to copy data to a local folder if needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The "C:\Users..." paths in this macro call would need to change.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%DOIT (TYPE = ACG ASA ASG ASH ASR AST ATG
BCG BSA BSG BSR BST BTM BTS ,
INDIR = C:\Users\〇〇(it's my name)\OneDrive - △△(it's my university's name).jp\デスクトップ\TIMSS2015_SASData,
OUTDIR = C:\Users\〇〇\OneDrive - △△.jp\デスクトップ\TIMSS SASデータ移行用) ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;Update&lt;/STRONG&gt;:&lt;/P&gt;
&lt;P&gt;I worked on a code method that seems to work more reliably than the T15_CONVERT.SAS sample that is provided by TIMSS 2015 site.&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;/* folder where the TIMSS *.exp files are */
%let in  = /home/myid/folder-with-exp-files;

/* folder to contain the converted data sets*/
%let out = /home/myid/folder-for-datasets;

data filenames;
length fref $8 fname $200;
did = filename(fref, "&amp;amp;in.");
did = dopen(fref);
do i = 1 to dnum(did);
  fname = dread(did,i);
  output;
end;
did = dclose(did);
did = filename(fref);
keep fname;
run;

libname outdir "&amp;amp;out.";

%macro convert(rootname=);
      PROC CIMPORT FILE="&amp;amp;in./&amp;amp;rootname..exp"
                   DATA=OUTDIR.&amp;amp;rootname. ;
      RUN; 
%mend;

data _null_;
 set filenames;
 root = scan(fname,1,".");
 call execute(%nrstr("%convert(rootname="||root||");"));
run;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Sep 2021 18:23:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/I-want-to-convert-TIMSS-2015-SAS-export-data-files-into-SAS-data/m-p/770205#M30856</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2021-09-24T18:23:04Z</dc:date>
    </item>
  </channel>
</rss>

