Hi,
I am running some code on Viya, but the second that I run one data step with an %include statement which scores data according to a logistic regression code file created above, I am no longer able to view any columns from that dataset and any datasets created after that. I have also made some changes to the code and had it where it is saying no items are available despite being created in the log, and when you go to look at the data the column names are completely different to what is being calculated and are from an earlier data step - when you click on the actual column to filter you can see the correct column names but outside of that it doesnt work.
No that doesn't make a difference just comes up with the same error message saying that the data cannot be retrieved.
Are you saying the log is showing that datasets got created but when you run code to reference them you cannot find them?
Or are you talking about trying to browse the dataset with SAS/Studio interface to VIYA?
Or something else?
When you %include the code do you use the /SOURCE option so that the code read from that file shows in the LOG? Is the code doing something that would interfere with SAS/Studio's setup. Like closing ODS destinations?
Says in the Log that the dataset has been created with observations and rows but i go to browse it it says the dataset has no items to view or all the columns are hidden.
It happened to me as well. In my understanding it's due to the fact that the name convention is not met for the columns. It happens to me with tables that result from uploading excel files with column names more like labels than names...
When I try to open this table or access it with data step code or proc contents i get an error message like this:
Invalid Table
The table "RISK.FSVBALA2405" cannot be opened because the table or column names are not valid SAS names.
So I've written this code which in a datastep runcode heals the faulty names by renaming.
%let tab=FSVBALA2405;
%let casy=risk;
%let varlist="";
proc cas;
action columninfo result=r /table={name="&tab.", caslib="&casy."};
print r;
describe r;
saveresult r dataout=work.xdata;
empty = 0;
if (r.columnInfo.nrows <= 0) then do;
empty = 1;
rc = symput("emptyTable", (string)empty);
end;
else do;
columns = "";
do i = 1 to r.columninfo.nrows;
if length(r["columninfo"][i,'column'])>32 THEN do;
symput("col", "'"||strip(r[1,i].column)||"'n");
columns = columns||" "||symget("col");
end;
end;
symput("varlist", substrn(columns,2,length(columns)-1));
end;
run;
quit;
%put &varlist.;
proc sql;
select cats("'"||strip(column)||"'n", '=',
lowcase(substr(translate(compress(upcase(column), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 _', "k"),
'_',' '), 1, 29)), monotonic())
into :outs separated by ' '
from xdata where length(column) > 32;
quit;
%put &outs.;
proc cas;
source myDataStep;
data FSVBALA (caslib="risk" promote="no");
set "FSVBALA2405" (caslib="risk" );
rename &outs.;
;
run;
endsource;
dataStep.runCode result=r status=rc /
code=myDataStep;
end;
run;
The rename lines lools like this:
'TIR mensual aplicado MANTENIMIENTO'n=tir_mensual_aplicado_mantenim1 |
'IMPORTE CUOTA AL ACTIVARGESTION MULTAS AL ACTIVAR'n=importe_cuota_al_activargesti2 |
'MODALIDAD GESTION DE MULTAS FIN DE MES'n=modalidad_gestion_de_multas_f3 |
'IMPORTE CUOTA MENSUAL CLENTE A FIN DE MES'n=importe_cuota_mensual_clente_4 |
'Código modalidad producto renting'n=cdigo_modalidad_producto_rent5 |
'Al inicio : modalidad de seguro como suplido'n=al_inicio__modalidad_de_segur6 |
'En actualidad : modalidad de seguro como suplido'n=en_actualidad__modalidad_de_s7 |
'Fecha cambio seguro de suplido a no suplido DÍA'n=fecha_cambio_seguro_de_suplid8 |
'Fecha cambio seguro de suplido a no suplido MES'n=fecha_cambio_seguro_de_suplid9 |
'Fecha cambio seguro de suplido a no suplido AÑO'n=fecha_cambio_seguro_de_suplid10 |
'Importe seguro pagado proveedor (sin extornos)'n=importe_seguro_pagado_proveed11 |
'Importe devengado acumulado periódico'n=importe_devengado_acumulado_p12 |
'Seguro NO Suplido: Importe Devengado Aperiódico'n=seguro_no_suplido_importe_dev13 |
Why not just set VALIVARNAME=V7 before importing the EXCEL file? or does VIYA not support that option?
Note also that SAS has an NLITERAL() function for converting strings into valid SAS name literals. So you can replace this code:
"'"||strip(column)||"'n"
(which will not work for "column" names that contain leading spaces or embedded single quotes) with
nliteral(column)
My problem was a different error, apparently something to do with the fact the table was too large and was a common error apparently. Still didn't find any solution.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!