i have panel time series.
I want to create a variable that is the difference between the last non-missing value and the first non-missing value.so in this case for Austria, the value would be 1 - 0 = "1".
I want to know the simplest code. I have been creating a variable that is the last value, and another variable that's the first value, and blah blah but i need to do this for so many variables, so i would that'd be a one liner command or something?
thank you!
"Australia" 193 1960 .
"Australia" 193 1961 .
"Australia" 193 1962 .
"Australia" 193 1963 .
"Australia" 193 1964 .
"Australia" 193 1965 .
"Australia" 193 1966 .
"Australia" 193 1967 .
"Australia" 193 1968 .
"Australia" 193 1969 .
"Australia" 193 1970 .
"Australia" 193 1971 .
"Australia" 193 1972 .
"Australia" 193 1973 .
"Australia" 193 1974 .
"Australia" 193 1975 .
"Australia" 193 1976 .
"Australia" 193 1977 .
"Australia" 193 1978 .
"Australia" 193 1979 .
"Australia" 193 1980 .
"Australia" 193 1981 .
"Australia" 193 1982 .
"Australia" 193 1983 .
"Australia" 193 1984 .
"Australia" 193 1985 .
"Australia" 193 1986 .
"Australia" 193 1987 .
"Australia" 193 1988 .
"Australia" 193 1989 .
"Australia" 193 1990 0
"Australia" 193 1991 -1
"Australia" 193 1992 -1
"Australia" 193 1993 -1
"Australia" 193 1994 -1
"Australia" 193 1995 -1
"Australia" 193 1996 0
"Australia" 193 1997 0
"Australia" 193 1998 0
"Australia" 193 1999 0
"Australia" 193 2000 0
"Australia" 193 2001 1
"Australia" 193 2002 0
"Australia" 193 2003 0
"Australia" 193 2004 0
"Australia" 193 2005 1
"Australia" 193 2006 0
"Australia" 193 2007 0
"Australia" 193 2008 0
"Australia" 193 2009 0
"Australia" 193 2010 -1
"Australia" 193 2011 -1
"Australia" 193 2012 -1
"Australia" 193 2013 0
"Australia" 193 2014 1
"Australia" 193 2015 .
"Australia" 193 2016 .
"Australia" 193 2017 .
"Australia" 193 2018 .
"Australia" 193 2019 .
"Australia" 193 2020 .
"Australia" 193 2021 .
"Austria" 122 1960 .
"Austria" 122 1961 .
"Austria" 122 1962 .
"Austria" 122 1963 .
"Austria" 122 1964 .
"Austria" 122 1965 .
"Austria" 122 1966 .
"Austria" 122 1967 .
"Austria" 122 1968 .
"Austria" 122 1969 .
"Austria" 122 1970 .
"Austria" 122 1971 .
"Austria" 122 1972 .
"Austria" 122 1973 .
"Austria" 122 1974 .
"Austria" 122 1975 .
"Austria" 122 1976 .
"Austria" 122 1977 .
"Austria" 122 1978 .
"Austria" 122 1979 .
"Austria" 122 1980 .
"Austria" 122 1981 .
"Austria" 122 1982 .
"Austria" 122 1983 .
"Austria" 122 1984 .
"Austria" 122 1985 .
"Austria" 122 1986 .
"Austria" 122 1987 .
"Austria" 122 1988 .
"Austria" 122 1989 .
"Austria" 122 1990 0
"Austria" 122 1991 0
"Austria" 122 1992 0
"Austria" 122 1993 0
"Austria" 122 1994 0
"Austria" 122 1995 0
"Austria" 122 1996 0
"Austria" 122 1997 0
I want to create a variable that is the difference between the last non-missing value and the first non-missing value.so in this case for Austria, the value would be 1 - 0 = "1".
I want to know the simplest code. I have been creating a variable that is the last value, and another variable that's the first value, and blah blah but i need to do this for so many variables, so i would that'd be a one liner command or something?
thank you!
"Australia" 193 1960 .
"Australia" 193 1961 .
"Australia" 193 1962 .
"Australia" 193 1963 .
"Australia" 193 1964 .
"Australia" 193 1965 .
"Australia" 193 1966 .
"Australia" 193 1967 .
"Australia" 193 1968 .
"Australia" 193 1969 .
"Australia" 193 1970 .
"Australia" 193 1971 .
"Australia" 193 1972 .
"Australia" 193 1973 .
"Australia" 193 1974 .
"Australia" 193 1975 .
"Australia" 193 1976 .
"Australia" 193 1977 .
"Australia" 193 1978 .
"Australia" 193 1979 .
"Australia" 193 1980 .
"Australia" 193 1981 .
"Australia" 193 1982 .
"Australia" 193 1983 .
"Australia" 193 1984 .
"Australia" 193 1985 .
"Australia" 193 1986 .
"Australia" 193 1987 .
"Australia" 193 1988 .
"Australia" 193 1989 .
"Australia" 193 1990 0
"Australia" 193 1991 -1
"Australia" 193 1992 -1
"Australia" 193 1993 -1
"Australia" 193 1994 -1
"Australia" 193 1995 -1
"Australia" 193 1996 0
"Australia" 193 1997 0
"Australia" 193 1998 0
"Australia" 193 1999 0
"Australia" 193 2000 0
"Australia" 193 2001 1
"Australia" 193 2002 0
"Australia" 193 2003 0
"Australia" 193 2004 0
"Australia" 193 2005 1
"Australia" 193 2006 0
"Australia" 193 2007 0
"Australia" 193 2008 0
"Australia" 193 2009 0
"Australia" 193 2010 -1
"Australia" 193 2011 -1
"Australia" 193 2012 -1
"Australia" 193 2013 0
"Australia" 193 2014 1
"Australia" 193 2015 .
"Australia" 193 2016 .
"Australia" 193 2017 .
"Australia" 193 2018 .
"Australia" 193 2019 .
"Australia" 193 2020 .
"Australia" 193 2021 .
"Austria" 122 1960 .
"Austria" 122 1961 .
"Austria" 122 1962 .
"Austria" 122 1963 .
"Austria" 122 1964 .
"Austria" 122 1965 .
"Austria" 122 1966 .
"Austria" 122 1967 .
"Austria" 122 1968 .
"Austria" 122 1969 .
"Austria" 122 1970 .
"Austria" 122 1971 .
"Austria" 122 1972 .
"Austria" 122 1973 .
"Austria" 122 1974 .
"Austria" 122 1975 .
"Austria" 122 1976 .
"Austria" 122 1977 .
"Austria" 122 1978 .
"Austria" 122 1979 .
"Austria" 122 1980 .
"Austria" 122 1981 .
"Austria" 122 1982 .
"Austria" 122 1983 .
"Austria" 122 1984 .
"Austria" 122 1985 .
"Austria" 122 1986 .
"Austria" 122 1987 .
"Austria" 122 1988 .
"Austria" 122 1989 .
"Austria" 122 1990 0
"Austria" 122 1991 0
"Austria" 122 1992 0
"Austria" 122 1993 0
"Austria" 122 1994 0
"Austria" 122 1995 0
"Austria" 122 1996 0
"Austria" 122 1997 0
Comment