BookmarkSubscribeRSS Feed
niespolo
Obsidian | Level 7

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,

4 REPLIES 4
Kurt_Bremser
Super User

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.

niespolo
Obsidian | Level 7
Hello,

 

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.

niespolo
Obsidian | Level 7

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 "". 

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 851 views
  • 0 likes
  • 2 in conversation