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;
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.
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 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.