BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Rita2021
Calcite | Level 5

Bom dia,

Eu tenho um codigo para criar a marcaçãp do mes

/*1.Cria a Marcação de faturamento por mes*/
data MARCACAO_MES;
anomes = input(put(char,8.), yymmn6.);
format anomes yymmn6.;

input anomes MARCACAO_MES $ ;
Datalines;
202101 FAT_JAN
202102 FAT_FEV
202103 FAT_MAR
202104 FAT_ABR
202105 FAT_MAI
202106 FAT_JUN
202107 FAT_JUL
202108 FAT_AGO
;

 

Só que na tabela que preciso cruzar com a tabela acima está em formato date9 e yymmn6 e length em byte 8 e não reconhece e o resultado fica em branco. E gostaria de transformar o codigo  acima neste formato.

Alguém tem uma luz? Eu sou nova no SAS ainda e estou apredendo.

 

Fico no aguardo e muito obrigada pela ajuda. 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Your code uses variable CHAR, but that variable doesn't exist.

 

Is this what you want? It reads ANOMES with informat YYMMN6., which makes it a numeric date variable.

 

data MARCACAO_MES;
input anomes yymmn6. MARCACAO_MES $ ;
format anomes yymmn6.;
datalines;
202101 FAT_JAN
202102 FAT_FEV
202103 FAT_MAR
202104 FAT_ABR
202105 FAT_MAI
202106 FAT_JUN
202107 FAT_JUL
202108 FAT_AGO
;
--
Paige Miller

View solution in original post

3 REPLIES 3
Rita2021
Calcite | Level 5

O codigo acima não deu certo.e o resultado ficou mto diferente.

PaigeMiller
Diamond | Level 26

Your code uses variable CHAR, but that variable doesn't exist.

 

Is this what you want? It reads ANOMES with informat YYMMN6., which makes it a numeric date variable.

 

data MARCACAO_MES;
input anomes yymmn6. MARCACAO_MES $ ;
format anomes yymmn6.;
datalines;
202101 FAT_JAN
202102 FAT_FEV
202103 FAT_MAR
202104 FAT_ABR
202105 FAT_MAI
202106 FAT_JUN
202107 FAT_JUL
202108 FAT_AGO
;
--
Paige Miller
Rita2021
Calcite | Level 5

Thank you very much for you help. That fine!! It´s correct.

 

Sorry foir delay.

 

Regards,

Rita

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 999 views
  • 1 like
  • 2 in conversation