BookmarkSubscribeRSS Feed
nicnad
Fluorite | Level 6

Hi,

I have the following code that is generated when I import a specific file. Is it possible to apply those same manipulation (convert string of text to column and format column) to an existing tableset in sas? Thank you for your help and time!

/* -------------------------------------------------------------------

   Code généré par une tâche SAS

   Généré le : mardi 19 mars 2013 à 16:45:54

   Par tâche : Importer des données

   Source de données : #LN00013

   Serveur :  SASMain

   ------------------------------------------------------------------- */

%_eg_conditional_dropds(SASUSER.TEST_SMALL);

%MACRO _EG_ImportData;

%LET IsMVS=FALSE;

DATA _NULL_;

  IF TRIM(SYMGET("SYSSCP")) = "OS" THEN

  IF GETOPTION("FILESYSTEM") = "MVS" THEN

  CALL SYMPUT("IsMVS", "TRUE");

  STOP;

RUN;

OPTIONS DATESTYLE=YMD;

DATA SASUSER.TEST_SMALL;

/* Enterprise Guide crée ce fichier texte temporaire délimité par des astérisques à partir de la source de données d'origine */

  INFILE #LN00013

  TRUNCOVER

  DSD

  %IF &IsMVS=FALSE %THEN %DO;

  LRECL=32767

  %END;

  ;

  LENGTH

  ApplProvenance $ 2

  TypeRecord $ 1

  TypeProvenance $ 1

  DateOperation $ 8

  HeureOperation $ 4

  SeqTransaction $ 8

  TypeOperation $ 2

  DescriptionAutre $ 20

  TypeCompte $ 1

  DepotNuit $ 1

  NoTransit $ 5

  NoCompte $ 7

  NoGuichet $ 5

  NoCarte $ 19

  NoCompagnieDepot $ 8

  DateInscription $ 8

  MontantOperation 8

  CodeDevise $ 3

  MontantBilletEspece 8

  MontantMonnaie 8

;

  INPUT

  @1 ApplProvenance  $2.

  @3 TypeRecord  $1.

  @4 TypeProvenance  $1.

  @5 DateOperation  $8.

  @13 HeureOperation  $4.

  @17 SeqTransaction  $8.

  @25 TypeOperation  $2.

  @27 DescriptionAutre  $20.

  @47 TypeCompte  $1.

  @48 DepotNuit  $1.

  @49 NoTransit  $5.

  @54 NoCompte  $7.

  @61 NoGuichet  $5.

  @66 NoCarte  $19.

  @85 NoCompagnieDepot  $8.

  @93 DateInscription  $8.

  @101 MontantOperation 14.

  @115 CodeDevise  $3.

  @118 MontantBilletEspece 14.

  @132 MontantMonnaie 32.

;

  LABEL

  ApplProvenance = "Column1"

  TypeRecord = "Column2"

  TypeProvenance = "Column3"

  DateOperation = "Column4"

  HeureOperation = "Column5"

  SeqTransaction = "Column6"

  TypeOperation = "Column7"

  DescriptionAutre = "Column8"

  TypeCompte = "Column9"

  DepotNuit = "Column10"

  NoTransit = "Column11"

  NoCompte = "Column12"

  NoGuichet = "Column13"

  NoCarte = "Column14"

  NoCompagnieDepot = "Column15"

  DateInscription = "Column16"

  MontantOperation = "Column17"

  CodeDevise = "Column18"

  MontantBilletEspece = "Column19"

  MontantMonnaie = "Column20"

;

RUN;

%MEND;

%_EG_ImportData

/* -------------------------------------------------------------------

   Fin du code de la tâche.

   ------------------------------------------------------------------- */

RUN; QUIT;

TITLE; FOOTNOTE;

RUN;

2 REPLIES 2
Reeza
Super User

If I understand you correctly you have a file, already in SAS, that doesn't have the same format as the one you've imported now. And you'd like to make the files have the same data types and formats?

I don't think there's an automatic way to do that in SAS EG, but you can hardcode your conversion to character/numeric.

nicnad
Fluorite | Level 6

Thank you very much for the quick reply.

I am using SAS enterprise 4.1 and I use the built-in function to import file to SAS server.

Do you know anyway to get the infile# of the file imported?

In the previous post, the file # was #LN00013.

Thank you for your help and time.

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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