12-05-2016 12:26 PM
I'm using SAS DI for writing some fields into a .csv file. But how is it possible to write a field containg spaces in its name?
Ex.: Considering the field named STATO CLIENTE, the automatically generated code in the FileWriter transformation fails:
3180 proc sql; 3181 create view work.WLIS8YD as 3182 select FIELD_OK as THIS_IS_CORRECT,
... 3244 STATO_CLIENTE_CRM as STATO CLIENTE,
ERROR 22-322: Expecting a name. ...
Is it possible to write the fied STATO CLIENTE in the file without removing the space?
12-05-2016 12:36 PM
STATO_CLIENTE_CRM label="STATO CLIENTE"
SAS generally uses Labels to provide better descriptive text than just the variable name and they allow much more text.
12-06-2016 06:00 AM
Ok, your code doesn't returns errors anymore. After, there are two pieces of code where STATO CLIENTE is used:
attrib STATO CLIENTE length = 8
format = 11.
informat = 11.;
quote='"'; file 'C:\Users\dlt_gec\Projects\Norma\GDC_ANG_NRM_010_DWH.csv' DSD dlm='|' lrecl=1000; if ( _n_ = 1 ) then do; put "BP_COLLEGATO|CF|CLUSTER_CLIENTE|..."@; put "...SF|STATO CLIENTE|COD_CLIENTE..."@; put "RUP|...|IMPORTO_FIDEJUSSIONE"; end; put BP_COLLEGATO CF CLUSTER_CLIENTE ... STATO CLIENTE RUP ...
The job runs without errors but the value in the field STATO CLIENTE is blank; I'm expecting the value 2. Infact, adding a new field TEST, mapped to STATO_CLIENTE_CRM, 2 is correctly writted in the TEST field.
What can be the reason that STATO CLIENTE is blank in the file?
12-07-2016 08:45 AM
Agree with @ballardw that using spaces is not a best practice.
But sometime source DBMS have them, or if you persists to have them, you can allow this by ticking "Enable special characters within DBMS object names" check box, which is available on every "Physical Storage" tab.
12-12-2016 04:49 AM
in my case, a field containing a space is not read from a database but a space is needed in an output field into a file.
Anyway, thanks for your suggestions, that could be useful for other cases in the future
12-12-2016 12:51 PM
Need further help from the community? Please ask a new question.