know the start date and the latest date on a table on SAS -


I am very fresh in the SAS world, however, although I used SAS during my studies last year but theoretical knowledge On the hands is not the same as knowledge.

This is my problem.

I have tables on the SAS, which look like the example below:

  Table 1 date var_1 var_2 var_3 var_4 var_5 1957 m1. . . . 1957 m2. . . 23.5 1957 m3 1.2. . 23.6 1957 M4 1.3. 23.7 1957 M5 1.4 0.123 23.8 1957 M6 1.5 0.124 23.9 1957 M7 1.6 3.0 0.125 23.10 1957 M8 1.7 3.1 0.126 23.11 1957 M 9 1.8 3.2 0.127 23.12 1957M10 2.1 1.9 3.3 0.128 23.13 1957M11 2.2 1.10 3.4 0.129 23.14 1957 M12 2.3 1.11 3.5 0.130 23.15  

As you have guessed, each variable is a time serial that is on its authority and date, there is also a time series, which are numerical except column column column That is a character

var_1 will start in October (or M10) in 1957 and the latest date will be December (or M12) in L 957

var_4 ac October will (or M10) began in 1 9 57 and the latest date would be December (M 12).

I have tried the following for one column through SAS: Table is in the form of a test but it is taking a long time hell without results.

  PROC SQL NOPRINT; Select MIN (Input (substrost (date, 1,4), date 4.)), maximum (input (substrost (date, 1,4), date 4.)) Table 1 to WHERE var_2 & lt; & Gt; "." leave;  

For my query, the date column is in the text. I am trying through my question that it has to be changed in date format with only one year, although only with the year I will remain and will be very good in months.

My boss gave me

cheers.

If you have a clue, then I'm taking it.

Your problem is that your data structure is not really correct for your problem.

The correct data structure is a more vertical structure with DATE, VAR, VALUE. Then PROC MEANS is perfect for your needs.

  is the data; Input Date $ var_1 var_2 var_3 var_4 var_5; Datalines; 1957 M1. . . . 1957 m2. . . 23.5 1957 m3 1.2. . 23.6 1957 M4 1.3. 23.7 1957 M5 1.4 0.123 23.8 1957 M6 1.5 0.124 23.9 1957 M7 1.6 3.0 0.125 23.10 1957 M8 1.7 3.1 0.126 23.11 1957 M 9 1.8 3.2 0.127 23.12 1957M10 2.1 1.9 3.3 0.128 23.13 1957M11 2.2 1.10 3.4 0.129 23.14 1957 M 02 2.3 1.11 3.5 0.130 23.15 ;;;; Run; Want data; Is set; Array var_ [5]; Date_num = mdy (substr (date, 6), 1, substr (date, 1,4)); To dim, do _iter = 1 (var_); If unavailable (var _ [_ iter]) do so; Var = vname (var _ [_ iter]); Value = var _ [_ iter]; Output; End; End; Format date_num MONYY.; Run; Proc mean = want; Class var; Var date_num; Output Out = Side_data min = max = / autoname; Run;  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -