Hi @Seb_A_Sanders
I think your only way out of the problem is to use SQL passthru. This way you can handle +32 long names of both tables and columns. Se the following code, which is a subset of working production code cut down to 3 variables:
options Validvarname = V7;
proc sql;
connect using xkmdne as sconn;
create table &_OUTPUT (label="archive_NEXUS2_medicine_medication_additional_information") as
select
medication_id
length=8 ,
administratively_deleted_datetim
length=8
format=nldatm20.
label="administratively_deleted_datetime" ,
last_past_fmk_dosage_period_end_
length=8
format=ddmmyyd10.
label="last_past_fmk_dosage_period_end_date"
from connection to sconn (
select
medication_id,
administratively_deleted_datetime
as administratively_deleted_datetim,
last_past_fmk_dosage_period_end_date
as last_past_fmk_dosage_period_end_
from archive_NEXUS2_medicine_medication_additional_information
);
disconnect from sconn;
quit;
Explanation:
Make a connection to the relevant SQL database using a previously assigned libname to the database.
Create a new SAS table with name abbreviated to 32 chars. Use original SQL table name as dataset label. select from connection to database, use original SQL column names as variable labels.
Connection to database gives the result of the second select, where long column names are abbreviated to sonething useful. This select is sent to execution in the database, so all long names are kept on the SQL Server side, and SAS sees only your abbreviations.
... View more