<?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: The table cannot be opened because it does not contain any columns help in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/The-table-cannot-be-opened-because-it-does-not-contain-any/m-p/784451#M10319</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*imports data from XLSX file;
proc import out=moldova 
datafile='/home/u57403500/ILE/Moldova_data_for_ILE.xlsx' 
dbms=xlsx replace; 
getnames=yes; 
run; 
 

*create formats for later usage;
proc format;
value HIVf 0='HIV Negative' 1='HIV Positive' 2='Unknown';
value genderf 1='Male' 2='Female';
value detentionf 1='Yes' 2='No';
value Hotspotf 1='Yes' 2='No';
value MDR 1='Resistant' 2='Other';

run;

data moldova2; *creates new data set called moldova2;
set moldova; *uses input from XLSX file called moldova;

*create HIV Status variable;
if aP28=3 then HIVStatus=0; 
else if aP28=2 then HIVStatus=1; 
else if aP28=1 and 4 then HIVStatus=2; 


*label variables;
label aP28='HIV Status'
	gender_P6='Gender'
	birth_day='Birthday'
	P11='Detention'
	P13_b='Hot Spot'
	P21_H='MDR Isoniazid'
	P21_R='MDR Rifampin'
	P21_E='MDR Ethambutol'
	P21_S= 'MDR Streptomycin'
	P21_Z='MDR Pyrazinamide'
	P21_Et='MDR Ethionomide'
	P21_Km='MDR Kanamycin'
	P21_O='MDR Ofloxacin'
	P21_Cs='MDR Cycloserine'
	P21_Ps='MDR p-Aminosalicylic acid';

*no idea what these do;
MDR=P21_H+P21_R+P21_E+P21_S+P21_Z+P21_Et+P21_Km+P21_O+P21_Cs+P21_Ps;
HIV=ap28;
Hotspot=p13_b;
Detention=p11;
gender=gender_P6;

*applies formats;
format HIV HIVf. gender genderf.
detention detentionf. Hotspot Hotspotf. ;

run; 

proc print data=moldova2(obs=10) label;
run;



 
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This should get you started - I'm fairly certain its not all correct but I don't have the file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/398517"&gt;@dchick&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I'm getting this error and I am not sure where I am going wrong. "&lt;SPAN&gt;The table "WORK.MOLDOVA" cannot be opened because it does not contain any columns."&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Thanks!&lt;/P&gt;
&lt;P&gt;Here is my code :&lt;/P&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;PRE&gt;&lt;CODE class=""&gt; 
proc import out=moldova 
datafile='/home/u57403500/ILE/Moldova_data_for_ILE.xlsx' 
dbms=xlsx replace; 
getnames=yes; 
run; 
 
data moldova; 
if aP28=3 then HIVStatus=0; 
else if aP28=2 then HIVStatus=1; 
else if aP28=1 and 4 then HIVStatus=2; 
run; 
 
data moldova; 
infile '/home/u57403500/ILE/Moldova_data_for_ILE.xlsx'; 
input id birth_day MMDDYY8.; 
today = DATE(); 
    days = today - birth_day; 
    age = floor(days / 365);  
    run; 
 
data moldova;  
label aP28='HIV Status' 
	gender_P6='Gender' 
	birth_day='Birthday' 
	P11='Detention' 
	P13_b='Hot Spot' &lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Dec 2021 03:05:41 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2021-12-07T03:05:41Z</dc:date>
    <item>
      <title>The table cannot be opened because it does not contain any columns help</title>
      <link>https://communities.sas.com/t5/SAS-Studio/The-table-cannot-be-opened-because-it-does-not-contain-any/m-p/784446#M10317</link>
      <description>&lt;P&gt;I'm getting this error and I am not sure where I am going wrong. "&lt;SPAN&gt;The table "WORK.MOLDOVA" cannot be opened because it does not contain any columns."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Thanks!&lt;/P&gt;&lt;P&gt;Here is my code :&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;PRE&gt;&lt;CODE class=""&gt; 
proc import out=moldova 
datafile='/home/u57403500/ILE/Moldova_data_for_ILE.xlsx' 
dbms=xlsx replace; 
getnames=yes; 
run; 
 
data moldova; 
if aP28=3 then HIVStatus=0; 
else if aP28=2 then HIVStatus=1; 
else if aP28=1 and 4 then HIVStatus=2; 
run; 
 
data moldova; 
infile '/home/u57403500/ILE/Moldova_data_for_ILE.xlsx'; 
input id birth_day MMDDYY8.; 
today = DATE(); 
    days = today - birth_day; 
    age = floor(days / 365);  
    run; 
 
data moldova;  
label aP28='HIV Status' 
	gender_P6='Gender' 
	birth_day='Birthday' 
	P11='Detention' 
	P13_b='Hot Spot' &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Dec 2021 02:56:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/The-table-cannot-be-opened-because-it-does-not-contain-any/m-p/784446#M10317</guid>
      <dc:creator>dchick</dc:creator>
      <dc:date>2021-12-07T02:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: The table cannot be opened because it does not contain any columns help</title>
      <link>https://communities.sas.com/t5/SAS-Studio/The-table-cannot-be-opened-because-it-does-not-contain-any/m-p/784450#M10318</link>
      <description>&lt;P&gt;There is more to the code it cut it off.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data moldova; 
label aP28='HIV Status'
	gender_P6='Gender'
	birth_day='Birthday'
	P11='Detention'
	P13_b='Hot Spot'
	P21_H='MDR Isoniazid'
	P21_R='MDR Rifampin'
	P21_E='MDR Ethambutol'
	P21_S= 'MDR Streptomycin'
	P21_Z='MDR Pyrazinamide'
	P21_Et='MDR Ethionomide'
	P21_Km='MDR Kanamycin'
	P21_O='MDR Ofloxacin'
	P21_Cs='MDR Cycloserine'
	P21_Ps='MDR p-Aminosalicylic acid';
run;

data moldova;
MDR=P21_H+P21_R+P21_E+P21_S+P21_Z+P21_Et+P21_Km+P21_O+P21_Cs+P21_Ps;
HIV=ap28;
Hotspot=p13_b;
Detention=p11;
gender=gender_P6;
run; 

data moldova;
proc format;
value HIVf 0='HIV Negative' 1='HIV Positive' 2='Unknown';
value genderf 1='Male' 2='Female';
value detentionf 1='Yes' 2='No';
value Hotspotf 1='Yes' 2='No';
value MDR 1='Resistant' 2='Other'
format HIV HIVf. gender genderf.
detention detentionf. Hotspot Hotspotf. ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Dec 2021 02:59:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/The-table-cannot-be-opened-because-it-does-not-contain-any/m-p/784450#M10318</guid>
      <dc:creator>dchick</dc:creator>
      <dc:date>2021-12-07T02:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: The table cannot be opened because it does not contain any columns help</title>
      <link>https://communities.sas.com/t5/SAS-Studio/The-table-cannot-be-opened-because-it-does-not-contain-any/m-p/784451#M10319</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*imports data from XLSX file;
proc import out=moldova 
datafile='/home/u57403500/ILE/Moldova_data_for_ILE.xlsx' 
dbms=xlsx replace; 
getnames=yes; 
run; 
 

*create formats for later usage;
proc format;
value HIVf 0='HIV Negative' 1='HIV Positive' 2='Unknown';
value genderf 1='Male' 2='Female';
value detentionf 1='Yes' 2='No';
value Hotspotf 1='Yes' 2='No';
value MDR 1='Resistant' 2='Other';

run;

data moldova2; *creates new data set called moldova2;
set moldova; *uses input from XLSX file called moldova;

*create HIV Status variable;
if aP28=3 then HIVStatus=0; 
else if aP28=2 then HIVStatus=1; 
else if aP28=1 and 4 then HIVStatus=2; 


*label variables;
label aP28='HIV Status'
	gender_P6='Gender'
	birth_day='Birthday'
	P11='Detention'
	P13_b='Hot Spot'
	P21_H='MDR Isoniazid'
	P21_R='MDR Rifampin'
	P21_E='MDR Ethambutol'
	P21_S= 'MDR Streptomycin'
	P21_Z='MDR Pyrazinamide'
	P21_Et='MDR Ethionomide'
	P21_Km='MDR Kanamycin'
	P21_O='MDR Ofloxacin'
	P21_Cs='MDR Cycloserine'
	P21_Ps='MDR p-Aminosalicylic acid';

*no idea what these do;
MDR=P21_H+P21_R+P21_E+P21_S+P21_Z+P21_Et+P21_Km+P21_O+P21_Cs+P21_Ps;
HIV=ap28;
Hotspot=p13_b;
Detention=p11;
gender=gender_P6;

*applies formats;
format HIV HIVf. gender genderf.
detention detentionf. Hotspot Hotspotf. ;

run; 

proc print data=moldova2(obs=10) label;
run;



 
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This should get you started - I'm fairly certain its not all correct but I don't have the file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/398517"&gt;@dchick&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I'm getting this error and I am not sure where I am going wrong. "&lt;SPAN&gt;The table "WORK.MOLDOVA" cannot be opened because it does not contain any columns."&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Thanks!&lt;/P&gt;
&lt;P&gt;Here is my code :&lt;/P&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;PRE&gt;&lt;CODE class=""&gt; 
proc import out=moldova 
datafile='/home/u57403500/ILE/Moldova_data_for_ILE.xlsx' 
dbms=xlsx replace; 
getnames=yes; 
run; 
 
data moldova; 
if aP28=3 then HIVStatus=0; 
else if aP28=2 then HIVStatus=1; 
else if aP28=1 and 4 then HIVStatus=2; 
run; 
 
data moldova; 
infile '/home/u57403500/ILE/Moldova_data_for_ILE.xlsx'; 
input id birth_day MMDDYY8.; 
today = DATE(); 
    days = today - birth_day; 
    age = floor(days / 365);  
    run; 
 
data moldova;  
label aP28='HIV Status' 
	gender_P6='Gender' 
	birth_day='Birthday' 
	P11='Detention' 
	P13_b='Hot Spot' &lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Dec 2021 03:05:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/The-table-cannot-be-opened-because-it-does-not-contain-any/m-p/784451#M10319</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-12-07T03:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: The table cannot be opened because it does not contain any columns help</title>
      <link>https://communities.sas.com/t5/SAS-Studio/The-table-cannot-be-opened-because-it-does-not-contain-any/m-p/784454#M10320</link>
      <description>&lt;P&gt;This definitely helps! Thank you!&lt;BR /&gt;Where you said you have no idea what those do was my attempt to combine variables and rename them. One last question where would I place the age statement?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;infile '/home/u57403500/ILE/Moldova_data_for_ILE.xlsx';
input id birth_day MMDDYY8.;
today = DATE();
    days = today - birth_day;
    age = floor(days / 365); &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Dec 2021 03:35:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/The-table-cannot-be-opened-because-it-does-not-contain-any/m-p/784454#M10320</guid>
      <dc:creator>dchick</dc:creator>
      <dc:date>2021-12-07T03:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: The table cannot be opened because it does not contain any columns help</title>
      <link>https://communities.sas.com/t5/SAS-Studio/The-table-cannot-be-opened-because-it-does-not-contain-any/m-p/784455#M10321</link>
      <description>&lt;P&gt;Why do you keep re-creating the same dataset over and over?&lt;/P&gt;
&lt;P&gt;This step will not create any real data&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data moldova; 
if aP28=3 then HIVStatus=0; 
else if aP28=2 then HIVStatus=1; 
else if aP28=1 and 4 then HIVStatus=2; 
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;because you don't have any input data.&amp;nbsp; Instead since you are referencing two variables they will be created and set to missing.&amp;nbsp; So none of your IF statements can be true.&amp;nbsp; Even the last one which is really just a test whether AP28 is 1 since the AND operator will treat the constant 4 as a TRUE value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This one cannot work because SAS will not be able to read a binary file such as an XLSX file as if it was a text file.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data moldova; 
infile '/home/u57403500/ILE/Moldova_data_for_ILE.xlsx'; 
input id birth_day MMDDYY8.; 
today = DATE(); 
    days = today - birth_day; 
    age = floor(days / 365);  
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>Tue, 07 Dec 2021 03:38:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/The-table-cannot-be-opened-because-it-does-not-contain-any/m-p/784455#M10321</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-12-07T03:38:13Z</dc:date>
    </item>
    <item>
      <title>Re: The table cannot be opened because it does not contain any columns help</title>
      <link>https://communities.sas.com/t5/SAS-Studio/The-table-cannot-be-opened-because-it-does-not-contain-any/m-p/784456#M10322</link>
      <description>Thank you! How would you create an age variable from a birthday (MMDDYYYY)?</description>
      <pubDate>Tue, 07 Dec 2021 03:43:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/The-table-cannot-be-opened-because-it-does-not-contain-any/m-p/784456#M10322</guid>
      <dc:creator>dchick</dc:creator>
      <dc:date>2021-12-07T03:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: The table cannot be opened because it does not contain any columns help</title>
      <link>https://communities.sas.com/t5/SAS-Studio/The-table-cannot-be-opened-because-it-does-not-contain-any/m-p/784457#M10323</link>
      <description>Move the code to the data step.</description>
      <pubDate>Tue, 07 Dec 2021 03:44:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/The-table-cannot-be-opened-because-it-does-not-contain-any/m-p/784457#M10323</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-12-07T03:44:42Z</dc:date>
    </item>
  </channel>
</rss>

