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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 991 views
  • 0 likes
  • 2 in conversation