Salve,
sto utilizzando SAS Data Integration Studio per scrivere, in un file di testo (.txt), alcuni campi letti da una tabella Oracle.
I valori dei campi scritti nel file sono racchiusi tra i doppi apici “ e “ e separati dal carattere ; ad esempio:
"TO_20147521221127";"4293675";"70419/ES";"1";"2";"42.00";"0.00";"0.00";"07MAR2015:00:00:00";"14FEB2015:00:00:00";".";"0";"0";".";"TO_21221127";"150.30";".";"13APR2015:16:01:56";" "
Ho evidenziato in nero l'ultimo e il penultimo campo.
L'ultimo campo, di tipo Numeric, è valorizzato con l’espressione: IFN(2=1,ID_FACTOR, ., .)
Il penultimo campo, di tipo Character, è invece valorizzato con l’espressione: IFC(2=1,"ID_FACTOR", "", "")
Poiché la condizione 2=1 è sempre falsa, entrambi i campi non saranno mai valorizzati con ID_FACTOR. Ma vorrei che tali campi siano scritti nel file entrambi con “”, anziché con "." e " " come mostrato nell’ esempio.
In altre parole, come potrei cambiare le espressioni per un campo Numeric e per un campo Character, evitando che nel file compaia “.” e “ “, ma facendo in modo che nel file sia scritto “” ?
Grazie,
Since there is not yet an Italian regional group here, I strongly suggest you post your question in English, as it will attract a larger pool of possible helpers.
I'm using SAS Data Integration Studio to write, in a text file (.txt), some fields read from an Oracle table.
Field values written to the file are enclosed in double quotes " and " and separated by the character ; eg:
"TO_20147521221127";"4293675";"70419/ES";"1";"2";"42.00";"0.00";"0.00";"07MAR2015:00:00:00";"14FEB2015:00:00:00";".";"0";"0";".";"TO_21221127";"150.30";".";"13APR2015:16:01:56";" "
I highlighted in red the last and the third to last field. The last field, of Numeric type, is enhanced with the expression:
IFN(2=1,ID_FACTOR, ., .)
The third to last field, of type Character, is instead enhanced with the expression:
IFC(2=1,"ID_FACTOR", "", "")
Since the condition 2 = 1 is always false, both fields will never be emphasized by using ID_FACTOR. But I wish that these fields are written to the file either with "", instead of "." and " " as shown in the example.
In other words, how could I change the expressions for a Numeric and a Character field, avoiding "." and " ", but to write " " in the file ?
Many thanks.
You will always get one blank, but
options missing = ' ';
will display a blank instead of the dot for missing numeric values.
Hi KurtBremser,
it doesn't work because the missing numbers are valued as " " and not with "" as I would like.
I've tried with:
options missing = ' ';
and with:
options missing = '';
but the output in the file is " " for blanks and not "".
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.